jason.asSyntax
Class ArithExpr

Package class diagram package ArithExpr
java.lang.Object
  extended by jason.asSyntax.DefaultTerm
      extended by jason.asSyntax.Literal
          extended by jason.asSyntax.Atom
              extended by jason.asSyntax.Structure
                  extended by jason.asSyntax.ArithFunctionTerm
                      extended by jason.asSyntax.ArithExpr
All Implemented Interfaces:
LogicalFormula, NumberTerm, Term, ToDOM, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Term>

public class ArithExpr
extends ArithFunctionTerm

Represents and solve arithmetic expressions like "10 + 30".

See Also:
Serialized Form

Nested Class Summary
static class ArithExpr.ArithmeticOp
           
 
Field Summary
 
Fields inherited from class jason.asSyntax.Structure
emptyTermArray, emptyTermList
 
Fields inherited from class jason.asSyntax.Literal
LFalse, LNeg, LPos, LTrue, predicateIndicatorCache
 
Fields inherited from class jason.asSyntax.DefaultTerm
hashCodeCache, srcInfo
 
Constructor Summary
ArithExpr(ArithExpr.ArithmeticOp oper, NumberTerm t1)
           
ArithExpr(NumberTerm t1, ArithExpr.ArithmeticOp oper, NumberTerm t2)
           
 
Method Summary
 boolean checkArity(int a)
           
 NumberTerm clone()
          make a hard copy of the terms
 org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
          get as XML
 NumberTerm getLHS()
          gets the LHS of this Expression
 ArithExpr.ArithmeticOp getOp()
          gets the Operation of this Expression
 NumberTerm getRHS()
          gets the RHS of this Expression
static NumberTerm parseExpr(Agent ag, java.lang.String sExpr)
          returns some Term that can be evaluated as Number
static NumberTerm parseExpr(java.lang.String sExpr)
          returns some Term that can be evaluated as Number
 double solve()
          computes the value for this arithmetic function (as defined in the NumberTerm interface)
 java.lang.String toString()
           
 
Methods inherited from class jason.asSyntax.ArithFunctionTerm
apply, calcHashCode, compareTo, equals, getAgent, getErrorMsg, getValue, isArithExpr, isAtom, isEvaluated, isGround, isLiteral, isNumeric, isStructure, isUnary, logicalConsequence, makeVarsAnnon, setAgent
 
Methods inherited from class jason.asSyntax.Structure
addTerm, addTerms, addTerms, countVars, delTerm, getArity, getSingletonVars, getTerm, getTerms, getTermsSize, hasTerm, hasVar, makeTermsAnnon, makeVarsAnnon, parse, setTerm, setTerms, varToReplace
 
Methods inherited from class jason.asSyntax.Atom
getFunctor
 
Methods inherited from class jason.asSyntax.Literal
addAnnot, addAnnots, addAnnots, addSource, canBeAddedInBB, clearAnnots, copy, delAnnot, delAnnots, delSource, delSources, equalsAsStructure, forceFullLiteralImpl, getAnnots, getAnnots, getAsListOfTerms, getPredicateIndicator, getSources, getTermsArray, hasAnnot, hasAnnot, hasSource, hasSource, hasSubsetAnnot, hasSubsetAnnot, importAnnots, negated, newFromListOfTerms, parseLiteral, setAnnots, setNegated
 
Methods inherited from class jason.asSyntax.DefaultTerm
getSrcInfo, hashCode, isInternalAction, isList, isPlanBody, isPred, isRule, isString, isUnnamedVar, isVar, resetHashCodeCache, setSrcInfo
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jason.asSyntax.Term
countVars, getSrcInfo, hasVar, isInternalAction, isList, isPlanBody, isPred, isRule, isString, isUnnamedVar, isVar, setSrcInfo
 

Constructor Detail

ArithExpr

public ArithExpr(NumberTerm t1,
                 ArithExpr.ArithmeticOp oper,
                 NumberTerm t2)

ArithExpr

public ArithExpr(ArithExpr.ArithmeticOp oper,
                 NumberTerm t1)
Method Detail

parseExpr

public static NumberTerm parseExpr(java.lang.String sExpr)
returns some Term that can be evaluated as Number


parseExpr

public static NumberTerm parseExpr(Agent ag,
                                   java.lang.String sExpr)
returns some Term that can be evaluated as Number


solve

public double solve()
Description copied from class: ArithFunctionTerm
computes the value for this arithmetic function (as defined in the NumberTerm interface)

Specified by:
solve in interface NumberTerm
Overrides:
solve in class ArithFunctionTerm

checkArity

public boolean checkArity(int a)
Overrides:
checkArity in class ArithFunctionTerm

clone

public NumberTerm clone()
make a hard copy of the terms

Specified by:
clone in interface Term
Overrides:
clone in class ArithFunctionTerm

getOp

public ArithExpr.ArithmeticOp getOp()
gets the Operation of this Expression


getLHS

public NumberTerm getLHS()
gets the LHS of this Expression


getRHS

public NumberTerm getRHS()
gets the RHS of this Expression


toString

public java.lang.String toString()
Overrides:
toString in class ArithFunctionTerm

getAsDOM

public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
get as XML

Specified by:
getAsDOM in interface ToDOM
Overrides:
getAsDOM in class ArithFunctionTerm