public class CompareNode extends ExpressionNode
Modifier and Type | Field and Description |
---|---|
static int |
EQUAL
The equal (==) operator.
|
static int |
GREATER
The greater-than (>) operator.
|
static int |
GREATEREQUAL
The greater-equal (>=) operator.
|
static int |
INSTANCEOF
The instanceof operator.
|
static int |
LESS
The less-than (<) operator.
|
static int |
LESSEQUAL
The less-equal (<=) operator.
|
protected int |
op
The operation.
|
static int |
UNEQUAL
The unequal (!=) operator.
|
constant, constant_value, expressiontext, imports, static_type, text
children, id, parent
Constructor and Description |
---|
CompareNode(jadex.javaparser.javaccimpl.ParserImpl p,
int id)
Create a node.
|
Modifier and Type | Method and Description |
---|---|
protected int |
compare(java.lang.Object val1,
java.lang.Object val2)
Compare two values.
|
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 |
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()
Check argument number, and precompute expression
when all children are constant.
|
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.
|
appendText, getConstantValue, getExpressionText, getParameters, getStaticType, getText, getUnboundParameterNodes, isConstant, precompileTree, setConstant, setConstantValue, setExpressionText, setStaticType, subnodeToString, throwEvaluationException, throwParseException, toString, toString
dump, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent
public static final int EQUAL
public static final int UNEQUAL
public static final int GREATER
public static final int LESS
public static final int GREATEREQUAL
public static final int LESSEQUAL
public static final int INSTANCEOF
protected int op
public CompareNode(jadex.javaparser.javaccimpl.ParserImpl p, int id)
p
- The parser.id
- The id.public void setText(java.lang.String text)
setText
in class ExpressionNode
text
- The token text.public void precompile()
precompile
in class ExpressionNode
public java.lang.Object getValue(IValueFetcher fetcher)
getValue
in interface IParsedExpression
getValue
in class ExpressionNode
params
- The parameters (string, value pairs), if any.public java.lang.String toPlainString()
toPlainString
in interface Node
toPlainString
in class ExpressionNode
protected int compare(java.lang.Object val1, java.lang.Object val2)
val1
- The first value.val2
- The second value.java.lang.ClassCastException
- when the values are not comparable.public static java.lang.String toString(int operator)
operator
- The operatorpublic static int fromString(java.lang.String operator)
operator
- The operator as string.public boolean equals(java.lang.Object o)
equals
in class ExpressionNode
public int hashCode()
hashCode
in class ExpressionNode