|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.emf.query.conditions.Condition
org.eclipse.emf.query.conditions.eobjects.EObjectCondition
org.eclipse.emf.query.ocl.conditions.AbstractOCLCondition<C,CLS,E>
public abstract class AbstractOCLCondition<C,CLS,E>
An abstract OCL condition class, used to apply OCL expressions to
EObjects. It allows the integration of OCL expressions with other
EObjectConditions.
This supports OCL expressions with or without an OCL classifier context. Expressions that have no OCL classifier context are context-free. Such conditions are useful in situations where either the elements on which the expressions will be evaluated are of an unknown type or where the same expression might be applicable to multiple, unrelated context types.
Note that this class is not intended to be extended "directly"
by clients. Clients may extend the BooleanOCLCondition class.
BooleanOCLCondition| Field Summary |
|---|
| Fields inherited from class org.eclipse.emf.query.conditions.eobjects.EObjectCondition |
|---|
E_FALSE, E_TRUE |
| Fields inherited from class org.eclipse.emf.query.conditions.Condition |
|---|
FALSE, TRUE |
| Constructor Summary | |
|---|---|
protected |
AbstractOCLCondition(Environment<?,C,?,?,?,?,?,?,?,?,CLS,E> env,
Query<C,CLS,E> oclQuery,
C contextClassifier,
IEStructuralFeatureValueGetter eStructuralFeatureValueGetter,
PruneHandler pruneHandler)
Initializes a query condition with compiled OCL query, a context classifier representing the type of "self" in the OCL expression, and an IEStructuralFeatureValueGetter to use to resolve the context
element for safe access to structural features, and a
PruneHandler to consult for pruning the content tree. |
protected |
AbstractOCLCondition(Environment<?,C,?,?,?,?,?,?,?,?,CLS,E> env,
String oclExpressionString,
C contextClassifier,
IEStructuralFeatureValueGetter eStructuralFeatureValueGetter)
Initializes a query condition with an OCL expression string, a context classifier representing the type of "self" in the OCL expression, and an IEStructuralFeatureValueGetter to use to resolve the context
element for safe access to structural features. |
protected |
AbstractOCLCondition(Environment<?,C,?,?,?,?,?,?,?,?,CLS,E> env,
String oclExpressionString,
C contextClassifier,
IEStructuralFeatureValueGetter eStructuralFeatureValueGetter,
PruneHandler pruneHandler)
Initializes a query condition with an OCL expression string, a context classifier representing the type of "self" in the OCL expression, and an IEStructuralFeatureValueGetter to use to resolve the context
element for safe access to structural features, and a prune-handler
to consult for pruning the object tree. |
| Method Summary | |
|---|---|
Object |
evaluate(EObject eObject)
Evaluates the OCL condition. |
protected C |
getContextClassifier()
Return the context classifier. |
IEStructuralFeatureValueGetter |
getEStructuralFeatureValueGetter()
Retrieves the strategy used by this OCL condition to access the values of structural featuress of model elements. |
protected Query<C,CLS,E> |
getOCLQuery()
Obtains the query compiled by the OCL interpreter, which represents the OCL expression. |
C |
getResultType(EObject eObject)
Returns the type of the ocl expression. |
protected boolean |
isContextFree()
Queries whether this OCL condition is context-free. |
boolean |
isSatisfied(EObject eObject)
Checks to see if an eObject is of a type conformant to the
context classifier of this condition. |
void |
setEStructuralFeatureValueGetter(IEStructuralFeatureValueGetter eStructuralFeatureValueGetter)
Assigns the strategy to be used by this OCL Condition to access the values of structural features of model elements. |
| Methods inherited from class org.eclipse.emf.query.conditions.eobjects.EObjectCondition |
|---|
AND, EQUIVALENT, getPruneHandler, IMPLIES, isSatisfied, OR, shouldPrune, XOR |
| Methods inherited from class org.eclipse.emf.query.conditions.Condition |
|---|
AND, EQUIVALENT, IMPLIES, OR, XOR |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractOCLCondition(Environment<?,C,?,?,?,?,?,?,?,?,CLS,E> env,
String oclExpressionString,
C contextClassifier,
IEStructuralFeatureValueGetter eStructuralFeatureValueGetter)
throws ParserException
IEStructuralFeatureValueGetter to use to resolve the context
element for safe access to structural features.
It defaults to using PruneHandler.NEVER to consult
for pruning.
NOTE: if contextClassifier is null,
then this becomes a context-free OCL condition.
env - an OCL environment in which to parse the expression.
Must not be nulloclExpressionString - The OCL expression to apply when evaluating this
OCLConditioncontextClassifier - The OCL context classifier.
Use null to create a context-free condition.eStructuralFeatureValueGetter - The strategy for accessing structural feature values. It
serves as a layer of indirection to allow clients to intervene
between this condition object and the way it extracts the
structural features' values so
as to allow for manipulation of such values before subjecting
them to evaluation by the OCL interpreter.
ParserException - on failure to parse the specified expression in
the given classifier context, if this is not a context-free query
protected AbstractOCLCondition(Environment<?,C,?,?,?,?,?,?,?,?,CLS,E> env,
String oclExpressionString,
C contextClassifier,
IEStructuralFeatureValueGetter eStructuralFeatureValueGetter,
PruneHandler pruneHandler)
throws ParserException
IEStructuralFeatureValueGetter to use to resolve the context
element for safe access to structural features, and a prune-handler
to consult for pruning the object tree.
NOTE: if contextClassifier is null,
then this becomes a context-free OCL condition.
env - an OCL environment in which to parse the expression.
Must not be nulloclExpressionString - The OCL expression to apply when evaluating this
OCLConditioncontextClassifier - The OCL context classifier.
Use null to create a context-free condition.eStructuralFeatureValueGetter - The strategy for accessing structural feature values. It
serves as a layer of indirection to allow clients to intervene
between this condition object and the way it extracts the
structural features' values so
as to allow for manipulation of such values before subjecting
them to evaluation by the OCL interpreter.pruneHandler - The PruneHandler to consult when pruning
ParserException - on failure to parse the specified expression in
the given classifier context, if this is not a context-free query
protected AbstractOCLCondition(Environment<?,C,?,?,?,?,?,?,?,?,CLS,E> env,
Query<C,CLS,E> oclQuery,
C contextClassifier,
IEStructuralFeatureValueGetter eStructuralFeatureValueGetter,
PruneHandler pruneHandler)
IEStructuralFeatureValueGetter to use to resolve the context
element for safe access to structural features, and a
PruneHandler to consult for pruning the content tree.
env - the OCL environment in which the OCL query was parsed.
Must not be nulloclQuery - The OCL query to apply when evaluating this conditioncontextClassifier - The OCL context classifier. Must not be null.eStructuralFeatureValueGetter - The strategy for accessing structural feature values. It
serves as a layer of indirection to allow clients to intervene
between this condition object and the way it extracts the
structural features' values so
as to allow for manipulation of such values before subjecting
them to evaluation by the OCL interpreter.pruneHandler - The PruneHandler to consult when pruning| Method Detail |
|---|
protected final Query<C,CLS,E> getOCLQuery()
null if
the condition is context-free and has not been initialized by
invocation of the isSatisfied(EObject) methodisContextFree(),
isSatisfied(EObject),
getResultType(EObject)public boolean isSatisfied(EObject eObject)
eObject is of a type conformant to the
context classifier of this condition.
isSatisfied in class EObjectConditioneObject - the EObject to check
true if the argument eObject satisfies
this EObjectConditiongetContextClassifier(),
isContextFree()public C getResultType(EObject eObject)
null in the case of a context-free OCL condition.
In the case of a context-free OCL condition, a context
eObject is required to guess the result type of the
expression. It is expected that the condition would subsequently be
evaluated on objects of the same type as the eObject.
eObject - required in the case of a context-free OCL condition, to
specify a context object. Otherwise, it is ignored and
a null value is acceptable
isContextFree(),
evaluate(EObject)protected final boolean isContextFree()
true if this is a context-free OCL condition;
false, otherwisegetResultType(EObject),
isSatisfied(EObject)public final IEStructuralFeatureValueGetter getEStructuralFeatureValueGetter()
public final void setEStructuralFeatureValueGetter(IEStructuralFeatureValueGetter eStructuralFeatureValueGetter)
eStructuralFeatureValueGetter - the structural feature value
accessor to usepublic Object evaluate(EObject eObject)
eObject - context for evaluation; can be null if the OCL
expression has no "self" object
EObject or a Java object), or any kind of
collection of such objectsprotected final C getContextClassifier()
null
if this is a context-free OCL condition.
isContextFree()
|
Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved. |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||