Package jadex.javaparser.javaccimpl
Class MathNode
- java.lang.Object
- 
- jadex.javaparser.javaccimpl.SimpleNode
- 
- jadex.javaparser.javaccimpl.ExpressionNode
- 
- jadex.javaparser.javaccimpl.MathNode
 
 
 
- 
- All Implemented Interfaces:
- IParsedExpression,- Node,- java.io.Serializable
 
 public class MathNode extends ExpressionNode Math node performs mathematical operations on it's (one or two) child nodes.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intADDThe plus operator.static intANDThe bitwise and operator.static intDIVIDEThe divide operator.static intLSHIFTThe left shift operator.static intMODULOThe modula operator.static intMULTIPLYThe multiply operator.static intNOTThe bitwise not operator (unary).protected intopThe operation.static intORThe bitwise or operator.static intRSHIFTThe right shift operator.static intSUBSTRACTThe minus operator.static intURSHIFTThe unsinged right shift operator.static intXORThe bitwise xor operator.- 
Fields inherited from class jadex.javaparser.javaccimpl.ExpressionNodeconstant, constant_value, expressiontext, imports, static_type, text
 - 
Fields inherited from class jadex.javaparser.javaccimpl.SimpleNodechildren, id, parent
 
- 
 - 
Constructor SummaryConstructors Constructor Description MathNode(jadex.javaparser.javaccimpl.ParserImpl p, int id)Create a node.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)Test if two nodes are equal.static intfromString(java.lang.String operator)Convert an operator from a string representation.java.lang.ObjectgetUnaryValue(IValueFetcher fetcher)Evaluate the term.java.lang.ObjectgetValue(IValueFetcher fetcher)Evaluate the expression in the given state with respect to given parameters.inthashCode()Get the hash code for the node.voidprecompile()Precompute the static type and constant value if possible.protected voidprecompileUnary()Precompile unary node.voidsetText(java.lang.String text)Set the token text.java.lang.StringtoPlainString()Create a string representation of this node and its subnodes.static java.lang.StringtoString(int operator)Convert an operator to a string representation.- 
Methods inherited from class jadex.javaparser.javaccimpl.ExpressionNodeappendText, getConstantValue, getExpressionText, getParameters, getStaticType, getText, getUnboundParameterNodes, isConstant, precompileTree, setConstant, setConstantValue, setExpressionText, setStaticType, subnodeToString, throwEvaluationException, throwParseException, toString, toString
 - 
Methods inherited from class jadex.javaparser.javaccimpl.SimpleNodedump, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent
 
- 
 
- 
- 
- 
Field Detail- 
ADDpublic static final int ADD The plus operator.- See Also:
- Constant Field Values
 
 - 
SUBSTRACTpublic static final int SUBSTRACT The minus operator.- See Also:
- Constant Field Values
 
 - 
MULTIPLYpublic static final int MULTIPLY The multiply operator.- See Also:
- Constant Field Values
 
 - 
DIVIDEpublic static final int DIVIDE The divide operator.- See Also:
- Constant Field Values
 
 - 
MODULOpublic static final int MODULO The modula operator.- See Also:
- Constant Field Values
 
 - 
ANDpublic static final int AND The bitwise and operator.- See Also:
- Constant Field Values
 
 - 
ORpublic static final int OR The bitwise or operator.- See Also:
- Constant Field Values
 
 - 
XORpublic static final int XOR The bitwise xor operator.- See Also:
- Constant Field Values
 
 - 
NOTpublic static final int NOT The bitwise not operator (unary).- See Also:
- Constant Field Values
 
 - 
LSHIFTpublic static final int LSHIFT The left shift operator.- See Also:
- Constant Field Values
 
 - 
RSHIFTpublic static final int RSHIFT The right shift operator.- See Also:
- Constant Field Values
 
 - 
URSHIFTpublic static final int URSHIFT The unsinged right shift operator.- See Also:
- Constant Field Values
 
 - 
opprotected int op The operation.
 
- 
 - 
Method Detail- 
setTextpublic void setText(java.lang.String text) Set the token text.- Overrides:
- setTextin class- ExpressionNode
- Parameters:
- text- The token text.
 
 - 
precompilepublic void precompile() Precompute the static type and constant value if possible.- Overrides:
- precompilein class- ExpressionNode
 
 - 
getValuepublic java.lang.Object getValue(IValueFetcher fetcher) Evaluate the expression in the given state with respect to given parameters.- Specified by:
- getValuein interface- IParsedExpression
- Specified by:
- getValuein class- ExpressionNode
- Parameters:
- params- The parameters (string, value pairs), if any.
- Returns:
- The value of the term.
 
 - 
precompileUnaryprotected void precompileUnary() Precompile unary node.
 - 
getUnaryValuepublic java.lang.Object getUnaryValue(IValueFetcher fetcher) Evaluate the term.- Parameters:
- params- The parameters (string, value).
- Returns:
- The value of the term.
 
 - 
toPlainStringpublic java.lang.String toPlainString() Create a string representation of this node and its subnodes.- Specified by:
- toPlainStringin interface- Node
- Overrides:
- toPlainStringin class- ExpressionNode
- Returns:
- A string representation of this node.
 
 - 
toStringpublic static java.lang.String toString(int operator) Convert an operator to a string representation.- Parameters:
- operator- The operator
- Returns:
- A string representation of the operator.
 
 - 
fromStringpublic static int fromString(java.lang.String operator) Convert an operator from a string representation.- Parameters:
- operator- The operator as string.
- Returns:
- The int value of the operator.
 
 - 
equalspublic boolean equals(java.lang.Object o) Test if two nodes are equal.- Overrides:
- equalsin class- ExpressionNode
 
 - 
hashCodepublic int hashCode() Get the hash code for the node.- Overrides:
- hashCodein class- ExpressionNode
 
 
- 
 
-