Class ChoiceHead
java.lang.Object
org.tweetyproject.lp.asp.syntax.ASPElement
org.tweetyproject.lp.asp.syntax.ASPHead
org.tweetyproject.lp.asp.syntax.ChoiceHead
- All Implemented Interfaces:
Formula,ComplexLogicalFormula,LogicStructure,SimpleLogicalFormula
This class is a variant of the basic ASP rule head. It
allows the usage of choice atoms as heads. Choice
atoms consist of choice elements and a binary operator
and term.
ChoiceElement- Author:
- Anna Gessler
-
Constructor Summary
ConstructorsConstructorDescriptionChoiceHead(List<ChoiceElement> elements) ChoiceHead(List<ChoiceElement> elements, ASPOperator.BinaryOperator rightOp, Term<?> rightTerm) ChoiceHead(List<ChoiceElement> elements, ASPOperator.BinaryOperator leftOp, Term<?> leftTerm, ASPOperator.BinaryOperator rightOp, Term<?> rightTerm) ChoiceHead(ChoiceElement e, ASPOperator.BinaryOperator rightOp, Term<?> rightTerm) -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates a deep copy of this formulabooleangetAtoms()Processes the set of all atoms which appear in this formulaReturn the choice elements of this choice atomTerm<?> Return the left guard (comparison term)Return the left comparison operator.Returns all literals in this element in form of a SortedSet.Processes the set of all predicates which appear in this formulaTerm<?> Return the right guard (comparison term)Return the right comparison operator.Returns the signature of the language of this formula.getTerms()Processes the set containing all terms of type C.inthashCode()booleanisEmpty()Return true if the head is empty, false otherwisebooleanReturns a representation of this ASP element in clingo (potassco) syntax.Returns a representation of this ASP element in DLV syntax.voidsetElements(List<ChoiceElement> elements) Set the choice elements of this choice atom.voidsetLeftGuard(Term<?> leftTerm) Set the left guard (comparison term)voidSet the left comparison operator.voidsetRightGuard(Term<?> rightTerm) Set the right guard (comparison term)voidSet the right comparison operator.substitute(Term<?> t, Term<?> v) 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.ASPElement
containsTermsOfType, exchange, getPredicateCls, isGround, isWellFormed, substitute
-
Constructor Details
-
ChoiceHead
public ChoiceHead(List<ChoiceElement> elements, ASPOperator.BinaryOperator leftOp, Term<?> leftTerm, ASPOperator.BinaryOperator rightOp, Term<?> rightTerm) - Parameters:
elements- list of ChoiceElementsleftOp- a BinaryOperatorleftTerm- left TermrightOp- a BinaryOperatorrightTerm- right Term
-
ChoiceHead
public ChoiceHead(List<ChoiceElement> elements, ASPOperator.BinaryOperator rightOp, Term<?> rightTerm) - Parameters:
elements- list of ChoiceElementsrightOp- a BinaryOperatorrightTerm- right Term
-
ChoiceHead
- Parameters:
e- list of ChoiceElements
-
ChoiceHead
- Parameters:
elements- list of ChoiceElements
-
ChoiceHead
- Parameters:
e- a ChoiceElementrightOp- a BinaryOperatorrightTerm- a term
-
-
Method Details
-
isLiteral
public boolean isLiteral()- Returns:
- true if the formula represents a literal in the language or false otherwise
-
getTerms
-
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
-
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
-
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 classASPElement- 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
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.
-
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
-
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
-
isEmpty
-
getLiterals
Description copied from class:ASPHeadReturns all literals in this element in form of a SortedSet. Literals are atoms or strict negations of atoms.- Specified by:
getLiteralsin classASPHead- Returns:
- all the literals used in the rule element
-
getElements
Return the choice elements of this choice atom- Returns:
- the choice elements of this choice atom
-
setElements
Set the choice elements of this choice atom.- Parameters:
elements- the elements
-
getLeftOperator
Return the left comparison operator.- Returns:
- the left comparison operator.
-
setLeftOperator
Set the left comparison operator.- Parameters:
leftOp- left operator
-
getRightOperator
Return the right comparison operator.- Returns:
- the right comparison operator.
-
setRightOperator
Set the right comparison operator.- Parameters:
rightOp- Operation
-
getLeftGuard
Return the left guard (comparison term)- Returns:
- the left guard (comparison term)
-
setLeftGuard
Set the left guard (comparison term)- Parameters:
leftTerm- left term
-
getRightGuard
Return the right guard (comparison term)- Returns:
- the right guard (comparison term)
-
setRightGuard
Set the right guard (comparison term)- Parameters:
rightTerm- the right term
-
toString
-
printToClingo
Description copied from class:ASPElementReturns a representation of this ASP element in clingo (potassco) syntax. See https://potassco.org/ for more information.- Overrides:
printToClingoin classASPElement- Returns:
- String representation in clingo syntax
-
printToDLV
Description copied from class:ASPElementReturns a representation of this ASP element in DLV syntax. See http://www.dlvsystem.com/html/DLV_User_Manual.html for more information.- Overrides:
printToDLVin classASPElement- Returns:
- String representation in DLV syntax
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceSimpleLogicalFormula- Overrides:
hashCodein classObject
-
equals
- Specified by:
equalsin interfaceSimpleLogicalFormula- Overrides:
equalsin classObject
-