public abstract class Expression extends Object
An expression is evaluated by calling evaluate(IEvaluationContext)
.
This class may be subclassed to provide specific expressions.
Modifier and Type | Field and Description |
---|---|
protected static String |
ATT_VALUE
Name of the value attribute of an expression (value is
value ). |
static Expression |
FALSE
The expression corresponding to
EvaluationResult.FALSE . |
protected static int |
HASH_CODE_NOT_COMPUTED
The constant integer hash code value meaning the hash code has not yet
been computed.
|
protected static int |
HASH_FACTOR
A factor for computing the hash code for all expressions.
|
static Expression |
TRUE
The expression corresponding to
EvaluationResult.TRUE . |
Constructor and Description |
---|
Expression() |
Modifier and Type | Method and Description |
---|---|
void |
collectExpressionInfo(ExpressionInfo info)
Collects information about this expression tree.
|
ExpressionInfo |
computeExpressionInfo()
Computes the expression information for the given expression tree.
|
protected int |
computeHashCode()
Method to compute the hash code for this object.
|
protected static boolean |
equals(Object[] leftArray,
Object[] rightArray)
Tests whether two arrays of objects are equal to each other.
|
protected static boolean |
equals(Object left,
Object right)
Checks whether two objects are equal using the
equals(Object) method of the left object. |
abstract EvaluationResult |
evaluate(IEvaluationContext context)
Evaluates this expression.
|
int |
hashCode() |
protected static int |
hashCode(Object object)
Returns the hash code for the given
object . |
protected static int |
hashCode(Object[] array)
Returns the hash code for the given array.
|
protected static final int HASH_CODE_NOT_COMPUTED
protected static final int HASH_FACTOR
protected static final String ATT_VALUE
value
).public static final Expression TRUE
EvaluationResult.TRUE
.public static final Expression FALSE
EvaluationResult.FALSE
.protected static final boolean equals(Object left, Object right)
equals(Object)
method of the left
object.
This method handles null
for either the left
or right
object.left
- the first object to compare; may be null
.right
- the second object to compare; may be null
.true
if the two objects are equivalent;
false
otherwise.protected static final boolean equals(Object[] leftArray, Object[] rightArray)
null
, but their elements may be
null
.leftArray
- the left array to compare; may be null
, and
may be empty and may contain null
elements.rightArray
- the right array to compare; may be null
,
and may be empty and may contain null
elements.true
if the arrays are equal length and the elements
at the same position are equal; false
otherwise.protected static final int hashCode(Object object)
object
. This method
handles null
.object
- the object for which the hash code is desired; may be
null
.null
.protected static final int hashCode(Object[] array)
null
.array
- the array for which the hash code is desired; may be
null
.null
.public abstract EvaluationResult evaluate(IEvaluationContext context) throws CoreException
context
- an evaluation context providing information like variable,
name spaces, etc. necessary to evaluate this expressionCoreException
- if the evaluation failed. The concrete reason is
defined by the subclass implementing this methodpublic final ExpressionInfo computeExpressionInfo()
This is a convenience method for collecting the expression information
using collectExpressionInfo(ExpressionInfo)
.
public void collectExpressionInfo(ExpressionInfo info)
info
- the expression information object used
to collect the informationprotected int computeHashCode()
fHashCode
field. If the value returned from the method equals HASH_CODE_NOT_COMPUTED
(e.g. -1
) then the value is incremented by one.
This default implementation calls super.hashCode()
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.