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
Constructors Constructor Description ArithmeticTerm(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 Type Method Description TermAdapter<?>
clone()
Creates a deep copy of the termTerm<?>
getLeft()
ASPOperator.ArithmeticOperator
getOperator()
Term<?>
getRight()
void
setOperator(ASPOperator.ArithmeticOperator op)
Sets the operator of this arithmetic term.java.lang.String
toString()
-
Methods inherited from class org.tweetyproject.logics.commons.syntax.TermAdapter
containsTermsOfType, equals, get, getSort, getTerms, getTerms, hashCode, set, substitute
-
-
-
-
Constructor Detail
-
ArithmeticTerm
public ArithmeticTerm(ASPOperator.ArithmeticOperator op, Term<?> left, Term<?> right)
Create a new arithmetic term with the given operator and left and right term.- Parameters:
op
- an arithmetic operatorleft
- termright
- term
-
ArithmeticTerm
public ArithmeticTerm(Term<?> t)
Creates an arithmetic term of the form '-(t)'- Parameters:
t
- a term
-
ArithmeticTerm
public ArithmeticTerm(ASPOperator.ArithmeticOperator op, Term<?> t)
Creates an arithmetic term of the form '-(t)'- Parameters:
op
- an operator, either '+' or '-'t
- a term
-
ArithmeticTerm
public ArithmeticTerm(Triple<ASPOperator.ArithmeticOperator,Term<?>,Term<?>> triple)
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
public ArithmeticTerm(ArithmeticTerm other)
Create a new arithmetic term that is a copy of the given arithmetic term.- Parameters:
other
- an arithmetic term
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classTermAdapter<Triple<ASPOperator.ArithmeticOperator,Term<?>,Term<?>>>
-
clone
public TermAdapter<?> 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
public ASPOperator.ArithmeticOperator getOperator()
- Returns:
- the arithmetic operator of this arithmetic term.
-
setOperator
public void setOperator(ASPOperator.ArithmeticOperator op)
Sets the operator of this arithmetic term.- Parameters:
op
- an arithmetic operator
-
getLeft
public Term<?> getLeft()
- Returns:
- the left subterm of this arithmetic term.
-
getRight
public Term<?> getRight()
- Returns:
- the right subterm of this arithmetic term.
-
-