Interface Atom
- All Superinterfaces:
Formula
,SimpleLogicalFormula
- All Known Implementing Classes:
AlwaysQuery
,ASPAtom
,ASPLiteral
,FolAtom
,HoldsQuery
,LdoArgument
,NecessarilyQuery
,Proposition
,QueryProposition
,StrictNegation
An atomic language construct, linked to its predicate
- Author:
- Tim Janus
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Gives common implementations for methods shared among atoms of different types.static enum
An enum containing the different return values of the setPredicate() method of Atom. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addArgument
(Term<?> arg) Adds an argument to the atom's argument listgetName()
boolean
setPredicate
(Predicate predicate) Changes the predicate of the atom.Methods inherited from interface org.tweetyproject.commons.Formula
getSignature
Methods inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.SimpleLogicalFormula
clone, equals, getAtoms, getPredicateCls, getPredicates, hashCode, isLiteral
-
Method Details
-
getName
String getName()- Returns:
- the name of the predicate
-
getPredicate
Predicate getPredicate()- Returns:
- the predicate of the atom
-
setPredicate
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
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
-
isComplete
boolean isComplete()- Returns:
- true if the size of the argument list is equal to the arity of the predicate
-