Class ComparativeAtom

  • All Implemented Interfaces:
    Formula, ComplexLogicalFormula, LogicStructure, SimpleLogicalFormula

    public class ComparativeAtom
    extends ASPBodyElement
    This class represents a comparative atom, meaning an expression of the form 't x u' where t,u are terms and x is in {<, <=, ==, !=, >, >=}. Comparative atoms are called "Built-in atoms" in the ASP-Core-2 standard.
    Author:
    Tim Janus, Thomas Vengels, Anna Gessler
    • Constructor Detail

      • ComparativeAtom

        public ComparativeAtom​(ASPOperator.BinaryOperator op,
                               Term<?> left,
                               Term<?> right)
        Create a new comparative atom with the given operator and left and right term.
        Parameters:
        op - a binary operator
        left - term
        right - term
      • ComparativeAtom

        public ComparativeAtom​(ComparativeAtom other)
        Copy-Constructor
        Parameters:
        other - another ComparativeAtom
    • Method Detail

      • getLiterals

        public java.util.SortedSet<ASPLiteral> getLiterals()
        Description copied from class: ASPBodyElement
        Returns all literals in this element in form of a SortedSet. Literals are atoms or strict negations of atoms.
        Specified by:
        getLiterals in class ASPBodyElement
        Returns:
        all the literals used in the rule element
      • getSignature

        public FolSignature getSignature()
        Description copied from interface: Formula
        Returns the signature of the language of this formula.
        Specified by:
        getSignature in interface Formula
        Specified by:
        getSignature in class ASPElement
        Returns:
        the signature of the language of this formula.
      • isLiteral

        public boolean isLiteral()
        Returns:
        true if the formula represents a literal in the language or false otherwise
      • getTerms

        public java.util.Set<Term<?>> getTerms()
        Returns:
        a set containing all terms of this logical structure
      • getLeft

        public Term<?> getLeft()
        Returns:
        the left (first) term of the comparative atom.
      • getRight

        public Term<?> getRight()
        Returns:
        the right (second) term of the comparative atom.
      • getTerms

        public <C extends Term<?>> java.util.Set<C> getTerms​(java.lang.Class<C> cls)
        Description copied from interface: LogicStructure
        Processes the set containing all terms of type C. This method uses the equals method of the given Class and therefore does not add terms which are sub classes of type C to the set.
        Type Parameters:
        C - the type of terms
        Parameters:
        cls - The Class structure containing type information about the searched term
        Returns:
        A set containing all terms of type C of this logical structure
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface SimpleLogicalFormula
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface SimpleLogicalFormula
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object