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 Summary
Fields Modifier and Type Field Description static int
ADD
The plus operator.static int
AND
The bitwise and operator.static int
DIVIDE
The divide operator.static int
LSHIFT
The left shift operator.static int
MODULO
The modula operator.static int
MULTIPLY
The multiply operator.static int
NOT
The bitwise not operator (unary).protected int
op
The operation.static int
OR
The bitwise or operator.static int
RSHIFT
The right shift operator.static int
SUBSTRACT
The minus operator.static int
URSHIFT
The unsinged right shift operator.static int
XOR
The bitwise xor operator.-
Fields inherited from class jadex.javaparser.javaccimpl.ExpressionNode
constant, constant_value, expressiontext, imports, static_type, text
-
Fields inherited from class jadex.javaparser.javaccimpl.SimpleNode
children, id, parent
-
-
Constructor Summary
Constructors Constructor Description MathNode(jadex.javaparser.javaccimpl.ParserImpl p, int id)
Create a node.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Test if two nodes are equal.static int
fromString(java.lang.String operator)
Convert an operator from a string representation.java.lang.Object
getUnaryValue(IValueFetcher fetcher)
Evaluate the term.java.lang.Object
getValue(IValueFetcher fetcher)
Evaluate the expression in the given state with respect to given parameters.int
hashCode()
Get the hash code for the node.void
precompile()
Precompute the static type and constant value if possible.protected void
precompileUnary()
Precompile unary node.void
setText(java.lang.String text)
Set the token text.java.lang.String
toPlainString()
Create a string representation of this node and its subnodes.static java.lang.String
toString(int operator)
Convert an operator to a string representation.-
Methods inherited from class jadex.javaparser.javaccimpl.ExpressionNode
appendText, getConstantValue, getExpressionText, getParameters, getStaticType, getText, getUnboundParameterNodes, isConstant, precompileTree, setConstant, setConstantValue, setExpressionText, setStaticType, subnodeToString, throwEvaluationException, throwParseException, toString, toString
-
Methods inherited from class jadex.javaparser.javaccimpl.SimpleNode
dump, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent
-
-
-
-
Field Detail
-
ADD
public static final int ADD
The plus operator.- See Also:
- Constant Field Values
-
SUBSTRACT
public static final int SUBSTRACT
The minus operator.- See Also:
- Constant Field Values
-
MULTIPLY
public static final int MULTIPLY
The multiply operator.- See Also:
- Constant Field Values
-
DIVIDE
public static final int DIVIDE
The divide operator.- See Also:
- Constant Field Values
-
MODULO
public static final int MODULO
The modula operator.- See Also:
- Constant Field Values
-
AND
public static final int AND
The bitwise and operator.- See Also:
- Constant Field Values
-
OR
public static final int OR
The bitwise or operator.- See Also:
- Constant Field Values
-
XOR
public static final int XOR
The bitwise xor operator.- See Also:
- Constant Field Values
-
NOT
public static final int NOT
The bitwise not operator (unary).- See Also:
- Constant Field Values
-
LSHIFT
public static final int LSHIFT
The left shift operator.- See Also:
- Constant Field Values
-
RSHIFT
public static final int RSHIFT
The right shift operator.- See Also:
- Constant Field Values
-
URSHIFT
public static final int URSHIFT
The unsinged right shift operator.- See Also:
- Constant Field Values
-
op
protected int op
The operation.
-
-
Method Detail
-
setText
public void setText(java.lang.String text)
Set the token text.- Overrides:
setText
in classExpressionNode
- Parameters:
text
- The token text.
-
precompile
public void precompile()
Precompute the static type and constant value if possible.- Overrides:
precompile
in classExpressionNode
-
getValue
public java.lang.Object getValue(IValueFetcher fetcher)
Evaluate the expression in the given state with respect to given parameters.- Specified by:
getValue
in interfaceIParsedExpression
- Specified by:
getValue
in classExpressionNode
- Parameters:
params
- The parameters (string, value pairs), if any.- Returns:
- The value of the term.
-
precompileUnary
protected void precompileUnary()
Precompile unary node.
-
getUnaryValue
public java.lang.Object getUnaryValue(IValueFetcher fetcher)
Evaluate the term.- Parameters:
params
- The parameters (string, value).- Returns:
- The value of the term.
-
toPlainString
public java.lang.String toPlainString()
Create a string representation of this node and its subnodes.- Specified by:
toPlainString
in interfaceNode
- Overrides:
toPlainString
in classExpressionNode
- Returns:
- A string representation of this node.
-
toString
public 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.
-
fromString
public 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.
-
equals
public boolean equals(java.lang.Object o)
Test if two nodes are equal.- Overrides:
equals
in classExpressionNode
-
hashCode
public int hashCode()
Get the hash code for the node.- Overrides:
hashCode
in classExpressionNode
-
-