org.eclipse.ocl.options
Class EvaluationOptions

java.lang.Object
  extended by org.eclipse.ocl.options.EvaluationOptions

public class EvaluationOptions
extends java.lang.Object

Options applicable to EvaluationEnvironments to customize their evaluation behaviour.

Since:
1.2
Author:
Christian W. Damus (cdamus)

Field Summary
static Option<java.lang.Boolean> ANY_LESS_IS_INVALID
           Evaluation option indicating whether an any iteration that selection no values should return invalid (true) or null (false option, default option).
static Option<java.lang.Boolean> CLOSURE_INCLUDES_SOURCES
           Evaluation option indicating whether a closure includes the sources (true) or excludes them (false, default).
static Option<java.lang.Boolean> DYNAMIC_DISPATCH
           Evaluation option indicating whether to perform dynamic source-type dependent dispatch of operation calls.
static Option<java.lang.Boolean> LAX_NULL_HANDLING
           Evaluation option indicating whether to implement lax handling of null values in certain OclAny-defined operations.
 
Method Summary
static
<T> T
getValue(EvaluationEnvironment<?,?,?,?,?> env, Option<T> option)
          Obtains the value of the specified option's setting in the the given environment's options map, adapting the environment as necessary to the Customizable API.
static
<T> void
setOption(EvaluationEnvironment<?,?,?,?,?> env, Option<T> option, T value)
          Add an option to apply to the specified environment, adapting it as necessary to the Customizable API.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAX_NULL_HANDLING

public static final Option<java.lang.Boolean> LAX_NULL_HANDLING

Evaluation option indicating whether to implement lax handling of null values in certain OclAny-defined operations. When true, the null.oclIsKindOf(OclType) and null.oclIsTypeOf(OclType) operations will return true for any OCL type instead of returning OclInvalid, as OclVoid is defined as conforming to all other types. Similarly, null.oclAsType(OclType) will return null for any OCL type instead of OclInvalid as prescribed by the OCL 2.0 Specification.

For backward compatibility with the 1.1 release behaviour, the default value of this option is true. For strict conformance to the specification, use false.

Since:
1.2

DYNAMIC_DISPATCH

public static final Option<java.lang.Boolean> DYNAMIC_DISPATCH

Evaluation option indicating whether to perform dynamic source-type dependent dispatch of operation calls.

For backward compatibility, the default value of this option is false. For Object Oriented behaviour use true.

Prior to OCL 2.5, when Object Oriented behaviour may be specified explicitly, it is debateable as to which behaviour is specification compliant.

To avoid a major performance degradation, the dynamic dispatcher uses a cache to avoid repeated searches for operations in the inheritance tree. The consequent cost of dynamic dispatch may therefore be a few percent, If the parsing option to use type caches is enabled, the evaluator may reuse the analysis cache and avoid some startup costs.

Since:
3.2

ANY_LESS_IS_INVALID

public static final Option<java.lang.Boolean> ANY_LESS_IS_INVALID

Evaluation option indicating whether an any iteration that selection no values should return invalid (true) or null (false option, default option).

The OCL specification up until at least 2.3.1 has a contradiction with words specifying that the return value should be null, while the equivalent OCL specifies that the return should be invalid. Since null could be an intended value as in Set{null}->any(true), the invalid return is clearly correct (OMG Issue 18504). However for compatibility null is the default.

Prior to the Kepler release: the Eclipse OCL 3.3 (Ecore), 4.1 (UML) return value was null

Since:
3.3

CLOSURE_INCLUDES_SOURCES

public static final Option<java.lang.Boolean> CLOSURE_INCLUDES_SOURCES

Evaluation option indicating whether a closure includes the sources (true) or excludes them (false, default). should return invalid (true) or null (false option, default option).

The closure iteration was prototyped by the Classic OCL and omitted sources, however when adopted by OCL 2.3 sources are included. So the default gives the legacy behavior. Setting the option true gives the OCL standard behavior.

Since:
3.4
Method Detail

setOption

public static <T> void setOption(EvaluationEnvironment<?,?,?,?,?> env,
                                 Option<T> option,
                                 T value)
Add an option to apply to the specified environment, adapting it as necessary to the Customizable API.

Parameters:
env - an evaluation environment on which to set an option
option - the option
value - the option's value
See Also:
Customizable.setOption(Option, Object)

getValue

public static <T> T getValue(EvaluationEnvironment<?,?,?,?,?> env,
                             Option<T> option)
Obtains the value of the specified option's setting in the the given environment's options map, adapting the environment as necessary to the Customizable API. If not already set, return the option's default value.

Parameters:
env - an evaluation environment on which to query an option
option - an option to query
Returns:
value of the option
See Also:
Customizable.getValue(Option)