Class StrictNegation

    • Constructor Detail

      • StrictNegation

        public StrictNegation​(ASPAtom atom)
        Creates a new negation with the given atom.
        Parameters:
        atom - an ASP atom
      • StrictNegation

        public StrictNegation​(Predicate p,
                              java.util.List<Term<?>> terms)
        Creates a new negation with the given predicate and terms.
        Parameters:
        p - predicate of the negated atom
        terms - terms of the negated atom
      • StrictNegation

        public StrictNegation​(StrictNegation other)
        Copy-Constructor
        Parameters:
        other - another StrictNegation
      • StrictNegation

        public StrictNegation​(java.lang.String name)
        Creates a new negation with the given name.
        Parameters:
        name - of the negated atom's predicate
    • 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.
      • 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
      • getName

        public java.lang.String getName()
        Returns:
        the name of the predicate
      • getPredicate

        public Predicate getPredicate()
        Returns:
        the predicate of the atom
      • setPredicate

        public Atom.RETURN_SET_PREDICATE setPredicate​(Predicate predicate)
        Description copied from interface: Atom
        Changes the predicate of the atom. Given an old Predicate po and a new predicate pn with their list of arguments types at(po) and at(pn) and the arguments of this Atom: arg(this) this method distinguishes between three cases: 1. The predicate only differ in the names, returning RSP_SUCCESS 2. The old predicates argument types is a sub-list of the new argument types then the method returns RSP_INCOMPLETE and the atoms isComplete() method returns false 3. The new predicates argument types is a sub-list of the old argument types then the method returns RSP_TRUNCATED and the arguments of this atom are truncated too and isComplete() returns true. 4. The old and new predicates' argument types differ then the list of arguments of the atom get cleared and isComplete() returns false.
        Parameters:
        predicate - some predicate
        Returns:
        Depends on the cases described above: 1. RSP_SUCCESS 2. RSP_INCOMPLETE 3. RSP_TRUNCATED 4. RSP_CLEARED
      • addArgument

        public void addArgument​(Term<?> arg)
                         throws LanguageException
        Description copied from interface: Atom
        Adds an argument to the atom's argument list
        Parameters:
        arg - The next argument
        Throws:
        LanguageException - If the language does not support arguments for their constructs.
      • getArguments

        public java.util.List<? extends Term<?>> getArguments()
        Returns:
        A list containing all the arguments of this specific atom
      • isComplete

        public boolean isComplete()
        Returns:
        true if the size of the argument list is equal to the arity of the predicate
      • compareTo

        public int compareTo​(ASPLiteral o)
      • cloneWithAddedTerm

        public ASPLiteral cloneWithAddedTerm​(Term<?> term)
        Description copied from class: ASPLiteral
        Creates a copy of the literal and adds the given term as argument to the end of the argument list.
        Specified by:
        cloneWithAddedTerm in class ASPLiteral
        Parameters:
        term - the new argument.
        Returns:
        A copy of the literal containing the given term as new argument.
      • getAtom

        public ASPAtom getAtom()
        Specified by:
        getAtom in class ASPLiteral
        Returns:
        The atom representing the literal.
      • substitute

        public StrictNegation substitute​(Term<?> v,
                                         Term<?> t)
                                  throws java.lang.IllegalArgumentException
        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 ASPBodyElement
        Parameters:
        v - the term to be substituted.
        t - the term to substitute.
        Returns:
        a formula where every occurrence of "v" is replaced by "t".
        Throws:
        java.lang.IllegalArgumentException - if "v" and "t" are of different sorts
      • hashCode

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

        public boolean equals​(java.lang.Object o)
        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