Package jason.asSyntax
Class ArithExpr
java.lang.Object
- All Implemented Interfaces:
LogicalFormula
,NumberTerm
,Term
,ToDOM
,ToJson
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Term>
public class ArithExpr extends ArithFunctionTerm implements NumberTerm
Represents and solve arithmetic expressions like "10 + 30".
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ArithExpr.ArithmeticOp
Nested classes/interfaces inherited from class jason.asSyntax.Literal
Literal.FalseLiteral, Literal.TrueLiteral
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Logger
logger
private ArithExpr.ArithmeticOp
op
private static long
serialVersionUID
Fields inherited from class jason.asSyntax.ArithFunctionTerm
value
Fields inherited from class jason.asSyntax.Structure
emptyTermArray, emptyTermList
Fields inherited from class jason.asSyntax.Literal
DefaultNS, LFalse, LNeg, LPos, LTrue, predicateIndicatorCache
Fields inherited from class jason.asSyntax.DefaultTerm
hashCodeCache, srcInfo
-
Constructor Summary
Constructors Modifier Constructor Description private
ArithExpr(ArithExpr ae)
ArithExpr(ArithExpr.ArithmeticOp oper, NumberTerm t1)
ArithExpr(NumberTerm t1, ArithExpr.ArithmeticOp oper, NumberTerm t2)
-
Method Summary
Modifier and Type Method Description Term
capply(Unifier u)
computes the value for this arithmetic function (as defined in the NumberTerm interface)boolean
checkArity(int a)
NumberTerm
clone()
make a hard copy of the termsLiteral
cloneNS(Atom newnamespace)
clone in another namespaceorg.w3c.dom.Element
getAsDOM(org.w3c.dom.Document document)
get as XMLNumberTerm
getLHS()
gets the LHS of this ExpressionArithExpr.ArithmeticOp
getOp()
gets the Operation of this ExpressionNumberTerm
getRHS()
gets the RHS of this Expressionstatic NumberTerm
parseExpr(Agent ag, java.lang.String sExpr)
returns some Term that can be evaluated as Numberstatic NumberTerm
parseExpr(java.lang.String sExpr)
returns some Term that can be evaluated as Numberjava.lang.String
toString()
Methods inherited from class jason.asSyntax.ArithFunctionTerm
compareTo, equals, getAgent, getErrorMsg, isArithExpr, isAtom, isLiteral, isNumeric, isStructure, logicalConsequence, setAgent, solve
Methods inherited from class jason.asSyntax.Structure
addTerm, addTerms, addTerms, calcHashCode, countVars, delTerm, getArity, getSingletonVars, getTerm, getTerms, getTermsSize, hasTerm, hasVar, isGround, isUnary, makeTermsAnnon, makeVarsAnnon, makeVarsAnnon, parse, setTerm, setTerms, subsumes, varToReplace
Methods inherited from class jason.asSyntax.Atom
getFunctor, getNS
Methods inherited from class jason.asSyntax.Literal
addAnnot, addAnnots, addAnnots, addSource, addSourceInfoAsAnnots, canBeAddedInBB, clearAnnots, copy, delAnnot, delAnnots, delAnnots, delSource, delSources, equalsAsStructure, forceFullLiteralImpl, getAnnot, getAnnots, getAnnots, getAsJson, getAsListOfTerms, getPredicateIndicator, getSources, getTermsArray, hasAnnot, hasAnnot, hasSource, hasSource, hasSubsetAnnot, hasSubsetAnnot, importAnnots, negated, newFromListOfTerms, newFunctor, noSource, parseLiteral, setAnnots, setNegated, subjectToBUF
Methods inherited from class jason.asSyntax.DefaultTerm
getCyclicVar, getSrcInfo, hashCode, isCyclicTerm, isInternalAction, isList, isMap, isPlanBody, isPred, isRule, isSet, isString, isUnnamedVar, isVar, resetHashCodeCache, setSrcInfo
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface jason.asSyntax.NumberTerm
solve
Methods inherited from interface jason.asSyntax.Term
countVars, equals, getCyclicVar, getSrcInfo, hasVar, isArithExpr, isAtom, isCyclicTerm, isGround, isInternalAction, isList, isLiteral, isMap, isNumeric, isPlanBody, isPred, isRule, isSet, isString, isStructure, isUnnamedVar, isVar, setSrcInfo, subsumes
Methods inherited from interface jason.util.ToJson
getAsJson, getAsJsonStr
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
- Constant Field Values
-
logger
private static java.util.logging.Logger logger -
op
-
-
Constructor Details
-
ArithExpr
-
ArithExpr
-
ArithExpr
-
-
Method Details
-
parseExpr
returns some Term that can be evaluated as Number -
parseExpr
returns some Term that can be evaluated as Number -
capply
Description copied from class:ArithFunctionTerm
computes the value for this arithmetic function (as defined in the NumberTerm interface)- Specified by:
capply
in interfaceTerm
- Overrides:
capply
in classArithFunctionTerm
-
checkArity
public boolean checkArity(int a)- Overrides:
checkArity
in classArithFunctionTerm
-
clone
make a hard copy of the terms- Specified by:
clone
in interfaceTerm
- Overrides:
clone
in classArithFunctionTerm
-
cloneNS
Description copied from interface:Term
clone in another namespace- Specified by:
cloneNS
in interfaceTerm
- Overrides:
cloneNS
in classArithFunctionTerm
-
getOp
gets the Operation of this Expression -
getLHS
gets the LHS of this Expression -
getRHS
gets the RHS of this Expression -
toString
public java.lang.String toString() -
getAsDOM
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)get as XML- Specified by:
getAsDOM
in interfaceToDOM
- Overrides:
getAsDOM
in classArithFunctionTerm
-