Package org.eclipse.core.expressions
Class Expression
java.lang.Object
org.eclipse.core.expressions.Expression
- Direct Known Subclasses:
ActiveShellExpression,CompositeExpression,CountExpression,EqualsExpression,LegacyHandlerSubmissionExpression,ReferenceExpression,TestExpression
Abstract base class for all expressions provided by the common
expression language.
An expression is evaluated by calling evaluate(IEvaluationContext).
This class may be subclassed to provide specific expressions.
- Since:
- 3.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringName of the value attribute of an expression (value isvalue).static final ExpressionThe expression corresponding toEvaluationResult.FALSE.protected static final intThe constant integer hash code value meaning the hash code has not yet been computed.protected static final intA factor for computing the hash code for all expressions.static final ExpressionThe expression corresponding toEvaluationResult.TRUE. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCollects information about this expression tree.final ExpressionInfoComputes the expression information for the given expression tree.protected intMethod to compute the hash code for this object.protected static final booleanTests whether two arrays of objects are equal to each other.protected static final booleanChecks whether two objects are equal using theequals(Object)method of theleftobject.abstract EvaluationResultevaluate(IEvaluationContext context) Evaluates this expression.inthashCode()protected static final intReturns the hash code for the givenobject.protected static final intReturns the hash code for the given array.
-
Field Details
-
HASH_CODE_NOT_COMPUTED
protected static final int HASH_CODE_NOT_COMPUTEDThe constant integer hash code value meaning the hash code has not yet been computed.- See Also:
-
HASH_FACTOR
protected static final int HASH_FACTORA factor for computing the hash code for all expressions.- See Also:
-
ATT_VALUE
Name of the value attribute of an expression (value isvalue).- See Also:
-
TRUE
The expression corresponding toEvaluationResult.TRUE. -
FALSE
The expression corresponding toEvaluationResult.FALSE.
-
-
Constructor Details
-
Expression
public Expression()
-
-
Method Details
-
equals
Checks whether two objects are equal using theequals(Object)method of theleftobject. This method handlesnullfor either theleftorrightobject.- Parameters:
left- the first object to compare; may benull.right- the second object to compare; may benull.- Returns:
trueif the two objects are equivalent;falseotherwise.- Since:
- 3.2
-
equals
Tests whether two arrays of objects are equal to each other. The arrays must not benull, but their elements may benull.- Parameters:
leftArray- the left array to compare; may benull, and may be empty and may containnullelements.rightArray- the right array to compare; may benull, and may be empty and may containnullelements.- Returns:
trueif the arrays are equal length and the elements at the same position are equal;falseotherwise.- Since:
- 3.2
-
hashCode
Returns the hash code for the givenobject. This method handlesnull.- Parameters:
object- the object for which the hash code is desired; may benull.- Returns:
- The hash code of the object; zero if the object is
null. - Since:
- 3.2
-
hashCode
Returns the hash code for the given array. This method handlesnull.- Parameters:
array- the array for which the hash code is desired; may benull.- Returns:
- the hash code of the array; zero if the object is
null. - Since:
- 3.2
-
evaluate
Evaluates this expression.- Parameters:
context- an evaluation context providing information like variable, name spaces, etc. necessary to evaluate this expression- Returns:
- the result of the expression evaluation
- Throws:
CoreException- if the evaluation failed. The concrete reason is defined by the subclass implementing this method
-
computeExpressionInfo
Computes the expression information for the given expression tree.This is a convenience method for collecting the expression information using
collectExpressionInfo(ExpressionInfo).- Returns:
- the expression information
- Since:
- 3.2
-
collectExpressionInfo
Collects information about this expression tree. This default implementation add the expression's type to the set of misbehaving expression types.- Parameters:
info- the expression information object used to collect the information- Since:
- 3.2
-
computeHashCode
protected int computeHashCode()Method to compute the hash code for this object. The result returned from this method in cached in thefHashCodefield. If the value returned from the method equalsHASH_CODE_NOT_COMPUTED(e.g.-1) then the value is incremented by one.This default implementation calls
super.hashCode()- Returns:
- a hash code for this object.
- Since:
- 3.2
-
hashCode
public int hashCode()
-