## org.eclipse.emf.query.ocl.conditions
Class OCLCondition

    java.lang.Object
      org.eclipse.emf.query.conditions.Condition
          org.eclipse.emf.query.conditions.eobjects.EObjectCondition
              org.eclipse.emf.query.ocl.conditions.OCLCondition

Direct Known Subclasses:
  OCLConstraintCondition

Deprecated. Prefer the `AbstractOCLCondition` class, which supports customization of the OCL parsing environment as well as other metamodels than Ecore

    @Deprecated
    public abstract class OCLCondition

extends EObjectCondition

An abstract OCL condition class, used to apply OCL expressions to `EObject`s. It allows the integration of OCL expressions with other `EObjectCondition`s.

This supports OCL expressions with or without an OCL classifier (`EClass`) 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 `OCLConstraintCondition` class.

See Also:
  `OCLConstraintCondition`

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`

`OCLCondition(Query oclQuery, EClass contextEObjectType, IEStructuralFeatureValueGetter eStructuralFeatureValueGetter, PruneHandler pruneHandler)`
Deprecated. Initializes a query condition with a compiled OCL query, an `EClass` representing the `EObject` type which the OCL expression uses as a context, an `IEStructuralFeatureValueGetter` to use to get values of `EStructuralFeature`s referenced by the OCL expression, and a `PruneHandler` to consult for pruning the content tree.

`protected`

`OCLCondition(String oclExpressionString, EClass contextEObjectType, IEStructuralFeatureValueGetter eStructuralFeatureValueGetter)`
Deprecated. Initializes a query condition with an OCL expression string, an `EClass` representing the `EObject` type which the OCL expression uses as a context, and an `IEStructuralFeatureValueGetter` to use to get values of `EStructuralFeature`s referenced by the OCL expression.

`protected`

`OCLCondition(String oclExpressionString, EClass contextEObjectType, IEStructuralFeatureValueGetter eStructuralFeatureValueGetter, PruneHandler pruneHandler)`
Deprecated. Initializes a query condition with an OCL expression string, an `EClass` representing the `EObject` type which the OCL expression uses as a context, an `IEStructuralFeatureValueGetter` to use to get values of `EStructuralFeature`s referenced by the OCL expression, and a `PruneHandler` to consult for pruning the content tree.

Method Summary
`Object` `evaluate(EObject eObject)` Deprecated. Evaluates the OCL condition.
`protected EClass` `getContextEObjectType()` Deprecated. Return the context `EClass`.
`IEStructuralFeatureValueGetter` `getEStructuralFeatureValueGetter()` Deprecated. Retrieves the strategy used by this `OCLCondition` to access the values of `EStructuralFeature`s of model elements.
`protected Query` `getOclQuery()` Deprecated. Obtains the query compiled by the OCL interpreter, which represents the OCL expression.
`EClassifier` `getResultType(EObject eObject)` Deprecated. Returns the type of the ocl expression.
`protected boolean` `isContextFree()` Deprecated. Queries whether this `OCLCondition` is context-free.
`boolean` `isSatisfied(EObject eObject)` Deprecated. Checks to see if an `eObject` is of a type conformant to the context of this `OCLCondition`.
`void` `setEStructuralFeatureValueGetter(IEStructuralFeatureValueGetter eStructuralFeatureValueGetter)` Deprecated. Assigns the strategy to be used by this `OCLCondition` to access the values of `EStructuralFeature`s 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

### OCLCondition

    protected OCLCondition(String oclExpressionString,
                           EClass contextEObjectType,
                           IEStructuralFeatureValueGetter eStructuralFeatureValueGetter)

  Deprecated.
  Initializes a query condition with an OCL expression string, an `EClass` representing the `EObject` type which the OCL expression uses as a context, and an `IEStructuralFeatureValueGetter` to use to get values of `EStructuralFeature`s referenced by the OCL expression. It defaults to using `PruneHandler.NEVER` to consult for pruning.

  NOTE: if `contextEObjectType` is `null`, then this becomes a context-free OCL condition.

  Parameters:
    `oclExpressionString` - The OCL expression to apply when evaluating this `OCLCondition`
    `contextEObjectType` - The `EClass` representing the OCL context classifier. Use `null` to create a context-free `OCLCondition`.
    `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 `EStructuralFeature`s' values so as to allow for manipulation of such values before subjecting them to evaluation by the OCL interpreter.

### OCLCondition

    protected OCLCondition(String oclExpressionString,
                           EClass contextEObjectType,
                           IEStructuralFeatureValueGetter eStructuralFeatureValueGetter,
                           PruneHandler pruneHandler)

  Deprecated.
  Initializes a query condition with an OCL expression string, an `EClass` representing the `EObject` type which the OCL expression uses as a context, an `IEStructuralFeatureValueGetter` to use to get values of `EStructuralFeature`s referenced by the OCL expression, and a `PruneHandler` to consult for pruning the content tree.

  NOTE: if `contextEObjectType` is `null`, then this becomes a context-free OCL condition.

  Parameters:
    `oclExpressionString` - The OCL expression to apply when evaluating this `OCLCondition`
    `contextEObjectType` - The `EClass` representing the OCL context classifier. Use `null` to create a context-free `OCLCondition`.
    `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 `EStructuralFeature`s' 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

### OCLCondition

    protected OCLCondition(Query oclQuery,
                           EClass contextEObjectType,
                           IEStructuralFeatureValueGetter eStructuralFeatureValueGetter,
                           PruneHandler pruneHandler)

  Deprecated.
  Initializes a query condition with a compiled OCL query, an `EClass` representing the `EObject` type which the OCL expression uses as a context, an `IEStructuralFeatureValueGetter` to use to get values of `EStructuralFeature`s referenced by the OCL expression, and a `PruneHandler` to consult for pruning the content tree.

  Parameters:
    `oclQuery` - The OCL query to apply when evaluating this `OCLCondition`
    `contextEObjectType` - The `EClass` representing 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 `EStructuralFeature`s' 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

### getOclQuery

    protected final Query getOclQuery()

  Deprecated.
  Obtains the query compiled by the OCL interpreter, which represents the OCL expression.

  Returns:
    the compiled OCL expression. This can be `null` if the condition is context-free and has not been initialized by invocation of the `isSatisfied(EObject)` method
  See Also:
    `isContextFree()`, `isSatisfied(EObject)`, `getResultType(EObject)`

### isSatisfied

    public boolean isSatisfied(EObject eObject)

  Deprecated.
  Checks to see if an `eObject` is of a type conformant to the context of this `OCLCondition`.

  Specified by:
    `isSatisfied` in class `EObjectCondition`
  Parameters:
    `eObject` - the `EObject` to check
  Returns:
    boolean `true` if the argument eObject satisfies this `EObjectCondition`
  See Also:
    `getContextEObjectType()`, `isContextFree()`

### getResultType

    public EClassifier getResultType(EObject eObject)

  Deprecated.
  Returns the type of the ocl expression. Note that the result can be `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`.

  Parameters:
    `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
  Returns:
    The type of the OCL expression (that is, the type of objects returned). This may be an `EClass` from your EMF metamodel or it may be an `EDataType` representing a Java language type
  See Also:
    `isContextFree()`, `evaluate(EObject)`

### isContextFree

    protected final boolean isContextFree()

  Deprecated.
  Queries whether this `OCLCondition` is context-free.

  Returns:
    `true` if this is a context-free OCL condition; `false`, otherwise
  See Also:
    `getResultType(EObject)`, `isSatisfied(EObject)`

### getEStructuralFeatureValueGetter

    public final IEStructuralFeatureValueGetter getEStructuralFeatureValueGetter()

  Deprecated.
  Retrieves the strategy used by this `OCLCondition` to access the values of `EStructuralFeature`s of model elements.

  Returns:
    the structural feature value accessor

### setEStructuralFeatureValueGetter

    public final void setEStructuralFeatureValueGetter(IEStructuralFeatureValueGetter eStructuralFeatureValueGetter)

  Deprecated.
  Assigns the strategy to be used by this `OCLCondition` to access the values of `EStructuralFeature`s of model elements.

  Parameters:
    `eStructuralFeatureValueGetter` - the structural feature value accessor to use

### evaluate

    public Object evaluate(EObject eObject)

  Deprecated.
  Evaluates the OCL condition. Uses context object, if there is any needed.

  Parameters:
    `eObject` - Context for evaluation; can be `null` if the OCL expression has no "self" object
  Returns:
    the result of evaluation: could be null, a single object (either an `EObject` or a Java object), or any kind of collection of such objects

### getContextEObjectType

    protected final EClass getContextEObjectType()

  Deprecated.
  Return the context `EClass`. Could be `null` if this is a context-free OCL condition.

  Returns:
    the context OCL classifier
  See Also:
    `isContextFree()`

Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved.