Package org.tweetyproject.lp.asp.syntax
Class StrictNegation
java.lang.Object
org.tweetyproject.lp.asp.syntax.ASPElement
org.tweetyproject.lp.asp.syntax.ASPBodyElement
org.tweetyproject.lp.asp.syntax.ASPLiteral
org.tweetyproject.lp.asp.syntax.StrictNegation
- All Implemented Interfaces:
Comparable<ASPLiteral>,Formula,Atom,ComplexLogicalFormula,Invertable,LogicStructure,SimpleLogicalFormula
This class models the strict negation of an atom (as opposed to a default
negation:
DefaultNegation).- Author:
- Tim Janus, Thomas Vengels, Anna Gessler
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.Atom
Atom.AtomImpl, Atom.RETURN_SET_PREDICATE -
Constructor Summary
ConstructorsConstructorDescriptionStrictNegation(String name)Creates a new negation with the given name.StrictNegation(Predicate p, List<Term<?>> terms)Creates a new negation with the given predicate and terms.StrictNegation(ASPAtom atom)Creates a new negation with the given atom.StrictNegation(StrictNegation other)Copy-Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidaddArgument(Term<?> arg)Adds an argument to the atom's argument listclone()Creates a deep copy of this formulacloneWithAddedTerm(Term<?> term)Creates a copy of the literal and adds the given term as argument to the end of the argument list.intcompareTo(ASPLiteral o)booleangetAtom()getAtoms()Processes the set of all atoms which appear in this formulaReturns all literals in this element in form of a SortedSet.getName()Processes the set of all predicates which appear in this formulaReturns the signature of the language of this formula.getTerms()Processes the set containing all terms of type C.inthashCode()booleansetPredicate(Predicate predicate)Changes the predicate of the atom.substitute(Term<?> v, Term<?> t)Substitutes all occurrences of term "v" in this formula by term "t" and returns the new formula.toString()Methods inherited from class org.tweetyproject.lp.asp.syntax.ASPLiteral
isLiteralMethods inherited from class org.tweetyproject.lp.asp.syntax.ASPElement
containsTermsOfType, exchange, getPredicateCls, isGround, isWellFormed, printToClingo, printToDLV, substituteMethods inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.SimpleLogicalFormula
getPredicateCls
-
Constructor Details
-
StrictNegation
Creates a new negation with the given atom.- Parameters:
atom- an ASP atom
-
StrictNegation
Creates a new negation with the given predicate and terms.- Parameters:
p- predicate of the negated atomterms- terms of the negated atom
-
StrictNegation
Copy-Constructor- Parameters:
other- another StrictNegation
-
StrictNegation
Creates a new negation with the given name.- Parameters:
name- of the negated atom's predicate
-
-
Method Details
-
getLiterals
Description copied from class:ASPBodyElementReturns all literals in this element in form of a SortedSet. Literals are atoms or strict negations of atoms.- Specified by:
getLiteralsin classASPBodyElement- Returns:
- all the literals used in the rule element
-
getPredicates
Description copied from interface:SimpleLogicalFormulaProcesses the set of all predicates which appear in this formula- Specified by:
getPredicatesin interfaceSimpleLogicalFormula- Specified by:
getPredicatesin classASPElement- Returns:
- all predicates that appear in this formula
-
getAtoms
Description copied from interface:SimpleLogicalFormulaProcesses the set of all atoms which appear in this formula- Specified by:
getAtomsin interfaceSimpleLogicalFormula- Specified by:
getAtomsin classASPElement- Returns:
- The set of all atoms
-
getSignature
Description copied from interface:FormulaReturns the signature of the language of this formula.- Specified by:
getSignaturein interfaceFormula- Specified by:
getSignaturein classASPElement- Returns:
- the signature of the language of this formula.
-
clone
Description copied from interface:SimpleLogicalFormulaCreates a deep copy of this formula- Specified by:
clonein interfaceComplexLogicalFormula- Specified by:
clonein interfaceSimpleLogicalFormula- Specified by:
clonein classASPElement- Returns:
- the cloned formula
-
getTerms
- Returns:
- a set containing all terms of this logical structure
-
getTerms
Description copied from interface:LogicStructureProcesses 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
- Returns:
- the name of the predicate
-
getPredicate
- Returns:
- the predicate of the atom
-
setPredicate
Description copied from interface:AtomChanges 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
Description copied from interface:AtomAdds 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
- 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
-
cloneWithAddedTerm
Description copied from class:ASPLiteralCreates a copy of the literal and adds the given term as argument to the end of the argument list.- Specified by:
cloneWithAddedTermin classASPLiteral- Parameters:
term- the new argument.- Returns:
- A copy of the literal containing the given term as new argument.
-
getAtom
- Specified by:
getAtomin classASPLiteral- Returns:
- The atom representing the literal.
-
complement
- Specified by:
complementin interfaceInvertable- Specified by:
complementin classASPLiteral- Returns:
- the complement of this formula.
-
substitute
Description copied from interface:ComplexLogicalFormulaSubstitutes all occurrences of term "v" in this formula by term "t" and returns the new formula.- Specified by:
substitutein interfaceComplexLogicalFormula- Specified by:
substitutein classASPBodyElement- 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:
IllegalArgumentException- if "v" and "t" are of different sorts
-
toString
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceSimpleLogicalFormula- Overrides:
hashCodein classObject
-
equals
- Specified by:
equalsin interfaceSimpleLogicalFormula- Overrides:
equalsin classObject
-