public class EvaluationOptions
extends java.lang.Object
EvaluationEnvironment
s to
customize their evaluation behaviour.Modifier and Type | Field and Description |
---|---|
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.
|
Modifier and Type | Method and Description |
---|---|
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. |
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.
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.
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
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.
public static <T> void setOption(EvaluationEnvironment<?,?,?,?,?> env, Option<T> option, T value)
Customizable
API.env
- an evaluation environment on which to set an optionoption
- the optionvalue
- the option's valueCustomizable.setOption(Option, Object)
public static <T> T getValue(EvaluationEnvironment<?,?,?,?,?> env, Option<T> option)
Customizable
API. If not already set, return the option's
default value.env
- an evaluation environment on which to query an optionoption
- an option to queryCustomizable.getValue(Option)