Package org.tweetyproject.lp.asp.syntax
Class ArithmeticTerm
java.lang.Object
org.tweetyproject.logics.commons.syntax.TermAdapter<Triple<ASPOperator.ArithmeticOperator,Term<?>,Term<?>>>
org.tweetyproject.lp.asp.syntax.ArithmeticTerm
- All Implemented Interfaces:
LogicStructure
,Term<Triple<ASPOperator.ArithmeticOperator,
Term<?>, Term<?>>>
public class ArithmeticTerm
extends TermAdapter<Triple<ASPOperator.ArithmeticOperator,Term<?>,Term<?>>>
This class represents an arithmetic term in the ASP-Core-2 format.
An arithmetic term is either '-(t)' or 't x u', where t and u
are terms and x is one of the operators {+,-,*,/,\}.
- Author:
- Anna Gessler
-
Constructor Summary
ConstructorDescriptionArithmeticTerm
(Triple<ASPOperator.ArithmeticOperator, Term<?>, Term<?>> triple) Create a new arithmetic term based on the given triple of an arithmetic operator and two terms.ArithmeticTerm
(Term<?> t) Creates an arithmetic term of the form '-(t)'ArithmeticTerm
(ArithmeticTerm other) Create a new arithmetic term that is a copy of the given arithmetic term.ArithmeticTerm
(ASPOperator.ArithmeticOperator op, Term<?> t) Creates an arithmetic term of the form '-(t)'ArithmeticTerm
(ASPOperator.ArithmeticOperator op, Term<?> left, Term<?> right) Create a new arithmetic term with the given operator and left and right term. -
Method Summary
Modifier and TypeMethodDescriptionTermAdapter
<?> clone()
Creates a deep copy of the termboolean
Term
<?> getLeft()
Return the left subterm of this arithmetic term.Return the arithmetic operator of this arithmetic term.Term
<?> getRight()
Return the right subterm of this arithmetic term.int
hashCode()
void
Sets the operator of this arithmetic term.toString()
Methods inherited from class org.tweetyproject.logics.commons.syntax.TermAdapter
containsTermsOfType, get, getSort, getTerms, getTerms, set, substitute
-
Constructor Details
-
ArithmeticTerm
Create a new arithmetic term with the given operator and left and right term.- Parameters:
op
- an arithmetic operatorleft
- termright
- term
-
ArithmeticTerm
Creates an arithmetic term of the form '-(t)'- Parameters:
t
- a term
-
ArithmeticTerm
Creates an arithmetic term of the form '-(t)'- Parameters:
op
- an operator, either '+' or '-'t
- a term
-
ArithmeticTerm
Create a new arithmetic term based on the given triple of an arithmetic operator and two terms.- Parameters:
triple
- of arithmetic term and two terms
-
ArithmeticTerm
Create a new arithmetic term that is a copy of the given arithmetic term.- Parameters:
other
- an arithmetic term
-
-
Method Details
-
toString
- Overrides:
toString
in classTermAdapter<Triple<ASPOperator.ArithmeticOperator,
Term<?>, Term<?>>>
-
clone
Description copied from interface:Term
Creates a deep copy of the term- Specified by:
clone
in interfaceTerm<Triple<ASPOperator.ArithmeticOperator,
Term<?>, Term<?>>> - Specified by:
clone
in classTermAdapter<Triple<ASPOperator.ArithmeticOperator,
Term<?>, Term<?>>> - Returns:
- the clone
-
getOperator
Return the arithmetic operator of this arithmetic term.- Returns:
- the arithmetic operator of this arithmetic term.
-
setOperator
Sets the operator of this arithmetic term.- Parameters:
op
- an arithmetic operator
-
getLeft
Return the left subterm of this arithmetic term.- Returns:
- the left subterm of this arithmetic term.
-
getRight
Return the right subterm of this arithmetic term.- Returns:
- the right subterm of this arithmetic term.
-
hashCode
public int hashCode()- Overrides:
hashCode
in classTermAdapter<Triple<ASPOperator.ArithmeticOperator,
Term<?>, Term<?>>>
-
equals
- Overrides:
equals
in classTermAdapter<Triple<ASPOperator.ArithmeticOperator,
Term<?>, Term<?>>>
-