Class AggregateHead

    • Constructor Detail

      • AggregateHead

        public AggregateHead​(AggregateAtom head)
        Creates a new ASPAggregateHead with the given aggregate atom.
        Parameters:
        head - an AggregateAtom
      • AggregateHead

        public AggregateHead()
        Creates a new empty ASPAggregateHead.
      • AggregateHead

        public AggregateHead​(java.util.List<ASPBodyElement> literals,
                             int leftBound,
                             int rightBound)
        Creates a new cardinality rule head.
        Parameters:
        literals - of the cardinality rule head
        leftBound - of the cardinality rule
        rightBound - of the cardinality rule
    • Method Detail

      • getFormula

        public AggregateAtom getFormula()
        Returns:
        the aggregate atom that makes up this rule head.
      • setFormula

        public void setFormula​(AggregateAtom head)
        Sets the aggregate atom that makes up this rule head.
        Parameters:
        head - the head to set
      • 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
      • 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
      • substitute

        public ASPElement substitute​(Term<?> t,
                                     Term<?> v)
        Description copied from interface: ComplexLogicalFormula
        Substitutes all occurrences of term "v" in this formula by term "t" and returns the new formula.
        Specified by:
        substitute in interface ComplexLogicalFormula
        Specified by:
        substitute in class ASPElement
        Parameters:
        t - the term to be substituted.
        v - the term to substitute.
        Returns:
        a formula where every occurrence of "v" is replaced by "t".
      • 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.
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in class ASPHead
        Returns:
        true if the head is empty, false otherwise
      • getLiterals

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

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

        public java.lang.String printToClingo()
        Description copied from class: ASPElement
        Returns a representation of this ASP element in clingo (potassco) syntax. See https://potassco.org/ for more information.
        Overrides:
        printToClingo in class ASPElement
        Returns:
        String representation in clingo syntax