Package jadex.javaparser.javaccimpl
Class ExpressionNode
- java.lang.Object
- 
- jadex.javaparser.javaccimpl.SimpleNode
- 
- jadex.javaparser.javaccimpl.ExpressionNode
 
 
- 
- All Implemented Interfaces:
- IParsedExpression,- Node,- java.io.Serializable
 - Direct Known Subclasses:
- ArgumentsNode,- ArrayNode,- BooleanNode,- CastNode,- CollectionNode,- CompareNode,- ConditionalNode,- ConstantNode,- MathNode,- ParameterNode,- ReflectNode,- SelectionNode,- SelectNode,- TypeNode
 
 public abstract class ExpressionNode extends SimpleNode implements IParsedExpression Base class of expression node hierarchy.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected booleanconstantIs the node value constant (independent of evaluation context and parameters)?protected java.lang.Objectconstant_valueThe constant value (if any).protected java.lang.StringexpressiontextThe expression text (if any).protected java.lang.String[]importsThe imports (if any).protected java.lang.Classstatic_typeThe static type (if any).protected java.lang.StringtextThe token text (if any).- 
Fields inherited from class jadex.javaparser.javaccimpl.SimpleNodechildren, id, parent
 
- 
 - 
Constructor SummaryConstructors Constructor Description ExpressionNode(jadex.javaparser.javaccimpl.ParserImpl p, int id)Create an expression node.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidappendText(java.lang.String text)Append to the token text.booleanequals(java.lang.Object o)Test if two nodes are equal.java.lang.ObjectgetConstantValue()Get the constant value.java.lang.StringgetExpressionText()Get the full expression text.java.util.Set<java.lang.String>getParameters()Get the parameters used in the expression.java.lang.Class<?>getStaticType()Get the static type.java.lang.StringgetText()Get the expression text.ParameterNode[]getUnboundParameterNodes()Get unbound parameter nodes.abstract 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.booleanisConstant()Get if the node is constant.voidprecompile()This method should be overridden to perform all possible checks and precompute all values (e.g.voidprecompileTree()Precompile this node and all subnodes.voidsetConstant(boolean constant)Set if the node is constant.voidsetConstantValue(java.lang.Object constant_value)Set the constant value.voidsetExpressionText(java.lang.String expressiontext)Get the full expression text.voidsetStaticType(java.lang.Class static_type)Set the static type.voidsetText(java.lang.String text)Set the token text.protected java.lang.StringsubnodeToString(int subnode)Create a string for a subnode.protected voidthrowEvaluationException(java.lang.Throwable ex)(Re)throw an exception that occured during evaluation and add a useful error message.protected voidthrowParseException(java.lang.Throwable ex)(Re)throw an exception that occured during parsing and add a useful error message.java.lang.StringtoPlainString()Create a string representation of this node for dumping in a tree.java.lang.StringtoString()Create a string representation of this node for dumping in a tree.java.lang.StringtoString(java.lang.String prefix)Create a string representation of this node for dumping in a tree.- 
Methods inherited from class jadex.javaparser.javaccimpl.SimpleNodedump, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent
 
- 
 
- 
- 
- 
Field Detail- 
textprotected java.lang.String text The token text (if any).
 - 
expressiontextprotected java.lang.String expressiontext The expression text (if any).
 - 
importsprotected java.lang.String[] imports The imports (if any).
 - 
static_typeprotected java.lang.Class static_type The static type (if any).
 - 
constantprotected boolean constant Is the node value constant (independent of evaluation context and parameters)?
 - 
constant_valueprotected java.lang.Object constant_value The constant value (if any).
 
- 
 - 
Method Detail- 
setExpressionTextpublic void setExpressionText(java.lang.String expressiontext) Get the full expression text.- Parameters:
- text- The expression text.
 
 - 
getExpressionTextpublic java.lang.String getExpressionText() Get the full expression text.- Specified by:
- getExpressionTextin interface- IParsedExpression
- Returns:
- The expression text.
 
 - 
setTextpublic void setText(java.lang.String text) Set the token text.- Parameters:
- text- The token text.
 
 - 
appendTextpublic void appendText(java.lang.String text) Append to the token text.- Parameters:
- text- The text to append.
 
 - 
setStaticTypepublic void setStaticType(java.lang.Class static_type) Set the static type.- Parameters:
- static_type- The static type.
 
 - 
setConstantValuepublic void setConstantValue(java.lang.Object constant_value) Set the constant value.- Parameters:
- constant_value- The constant value.
 
 - 
getConstantValuepublic java.lang.Object getConstantValue() Get the constant value. The constant value of a node may be known, when it is independent of the evaluation context, and the child nodes are constant, too.- Returns:
- The constant value.
 
 - 
setConstantpublic void setConstant(boolean constant) Set if the node is constant.- Parameters:
- constant- The constant.
 
 - 
isConstantpublic boolean isConstant() Get if the node is constant. The node is constant, when it is independent of the evaluation context, and the child nodes are constant, too.- Returns:
- The constant flag.
 
 - 
toStringpublic java.lang.String toString(java.lang.String prefix) Create a string representation of this node for dumping in a tree.- Overrides:
- toStringin class- SimpleNode
- Returns:
- A string representation of this node.
 
 - 
toPlainStringpublic java.lang.String toPlainString() Create a string representation of this node for dumping in a tree.- Specified by:
- toPlainStringin interface- Node
- Returns:
- A string representation of this node.
 
 - 
toStringpublic java.lang.String toString() Create a string representation of this node for dumping in a tree.- Overrides:
- toStringin class- SimpleNode
- Returns:
- A string representation of this node.
 
 - 
subnodeToStringprotected java.lang.String subnodeToString(int subnode) Create a string for a subnode. Automatically adds braces if necessary.- Parameters:
- subnode- The index of the subnode.
- Returns:
- The string for the subnode.
 
 - 
getTextpublic java.lang.String getText() Get the expression text.- Returns:
- The text.
 
 - 
getValuepublic abstract java.lang.Object getValue(IValueFetcher fetcher) Evaluate the expression in the given state with respect to given parameters.- Specified by:
- getValuein interface- IParsedExpression
- Parameters:
- params- The parameters (string, value pairs), if any.
- Returns:
- The value of the term.
 
 - 
getStaticTypepublic java.lang.Class<?> getStaticType() Get the static type. If no information about the return type of an expression is available (e.g. because it depends on the evaluation context), the static type is null.- Specified by:
- getStaticTypein interface- IParsedExpression
- Returns:
- The static type.
 
 - 
getParameterspublic java.util.Set<java.lang.String> getParameters() Get the parameters used in the expression.- Specified by:
- getParametersin interface- IParsedExpression
 
 - 
getUnboundParameterNodespublic ParameterNode[] getUnboundParameterNodes() Get unbound parameter nodes.- Returns:
- The unbound parameter nodes.
 
 - 
precompilepublic void precompile() This method should be overridden to perform all possible checks and precompute all values (e.g. the static_type), which are independent of the evaluation context and parameters.
 - 
precompileTreepublic void precompileTree() Precompile this node and all subnodes.
 - 
throwParseExceptionprotected void throwParseException(java.lang.Throwable ex) throws ParseException(Re)throw an exception that occured during parsing and add a useful error message.- Parameters:
- ex- The exception to be rethrown (if any).
- Throws:
- ParseException
 
 - 
throwEvaluationExceptionprotected void throwEvaluationException(java.lang.Throwable ex) throws java.lang.RuntimeException(Re)throw an exception that occured during evaluation and add a useful error message.- Parameters:
- ex- The exception to be rethrown (if any).
- Throws:
- java.lang.RuntimeException
 
 - 
equalspublic boolean equals(java.lang.Object o) Test if two nodes are equal.- Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() Get the hash code for the node.- Overrides:
- hashCodein class- java.lang.Object
 
 
- 
 
-