Package jadex.javaparser.javaccimpl
Class CompareNode
- java.lang.Object
- 
- jadex.javaparser.javaccimpl.SimpleNode
- 
- jadex.javaparser.javaccimpl.ExpressionNode
- 
- jadex.javaparser.javaccimpl.CompareNode
 
 
 
- 
- All Implemented Interfaces:
- IParsedExpression,- Node,- java.io.Serializable
 
 public class CompareNode extends ExpressionNode Compare node compares it's (two) child nodes. Also supports instanceof operator (second child has to evaluate to class object).- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intEQUALThe equal (==) operator.static intGREATERThe greater-than (>) operator.static intGREATEREQUALThe greater-equal (>=) operator.static intINSTANCEOFThe instanceof operator.static intLESSThe less-than (<) operator.static intLESSEQUALThe less-equal (<=) operator.protected intopThe operation.static intUNEQUALThe unequal (!=) 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 CompareNode(jadex.javaparser.javaccimpl.ParserImpl p, int id)Create a node.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intcompare(java.lang.Object val1, java.lang.Object val2)Compare two values.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.ObjectgetValue(IValueFetcher fetcher)Evaluate the expression in the given state with respect to given parameters.inthashCode()Get the hash code for the node.voidprecompile()Check argument number, and precompute expression when all children are constant.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- 
EQUALpublic static final int EQUAL The equal (==) operator.- See Also:
- Constant Field Values
 
 - 
UNEQUALpublic static final int UNEQUAL The unequal (!=) operator.- See Also:
- Constant Field Values
 
 - 
GREATERpublic static final int GREATER The greater-than (>) operator.- See Also:
- Constant Field Values
 
 - 
LESSpublic static final int LESS The less-than (<) operator.- See Also:
- Constant Field Values
 
 - 
GREATEREQUALpublic static final int GREATEREQUAL The greater-equal (>=) operator.- See Also:
- Constant Field Values
 
 - 
LESSEQUALpublic static final int LESSEQUAL The less-equal (<=) operator.- See Also:
- Constant Field Values
 
 - 
INSTANCEOFpublic static final int INSTANCEOF The instanceof 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() Check argument number, and precompute expression when all children are constant.- 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.
 
 - 
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.
 
 - 
compareprotected int compare(java.lang.Object val1, java.lang.Object val2)Compare two values.- Parameters:
- val1- The first value.
- val2- The second value.
- Returns:
- A negative integer, zero, or a positive integer as the first value is less than, equal to, or greater than the second value.
- Throws:
- java.lang.ClassCastException- when the values are not comparable.
 
 - 
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
 
 
- 
 
-