Package org.tweetyproject.lp.asp.syntax
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
ConstructorDescriptionChoiceHead
(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 formulaboolean
getAtoms()
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.int
hashCode()
boolean
isEmpty()
Return true if the head is empty, false otherwiseboolean
Returns a representation of this ASP element in clingo (potassco) syntax.Returns a representation of this ASP element in DLV syntax.void
setElements
(List<ChoiceElement> elements) Set the choice elements of this choice atom.void
setLeftGuard
(Term<?> leftTerm) Set the left guard (comparison term)void
Set the left comparison operator.void
setRightGuard
(Term<?> rightTerm) Set the right guard (comparison term)void
Set 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: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
-
getPredicates
Description copied from interface:SimpleLogicalFormula
Processes the set of all predicates which appear in this formula- Specified by:
getPredicates
in interfaceSimpleLogicalFormula
- Specified by:
getPredicates
in classASPElement
- Returns:
- all predicates that appear in this formula
-
substitute
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 interfaceComplexLogicalFormula
- Specified by:
substitute
in 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:Formula
Returns the signature of the language of this formula.- Specified by:
getSignature
in interfaceFormula
- Specified by:
getSignature
in classASPElement
- Returns:
- the signature of the language of this formula.
-
getAtoms
Description copied from interface:SimpleLogicalFormula
Processes the set of all atoms which appear in this formula- Specified by:
getAtoms
in interfaceSimpleLogicalFormula
- Specified by:
getAtoms
in classASPElement
- Returns:
- The set of all atoms
-
clone
Description copied from interface:SimpleLogicalFormula
Creates a deep copy of this formula- Specified by:
clone
in interfaceComplexLogicalFormula
- Specified by:
clone
in interfaceSimpleLogicalFormula
- Specified by:
clone
in classASPElement
- Returns:
- the cloned formula
-
isEmpty
-
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 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:ASPElement
Returns a representation of this ASP element in clingo (potassco) syntax. See https://potassco.org/ for more information.- Overrides:
printToClingo
in classASPElement
- Returns:
- String representation in clingo syntax
-
printToDLV
Description copied from class:ASPElement
Returns a representation of this ASP element in DLV syntax. See http://www.dlvsystem.com/html/DLV_User_Manual.html for more information.- Overrides:
printToDLV
in classASPElement
- Returns:
- String representation in DLV syntax
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceSimpleLogicalFormula
- Overrides:
hashCode
in classObject
-
equals
- Specified by:
equals
in interfaceSimpleLogicalFormula
- Overrides:
equals
in classObject
-