Interface IEvlContext
-
- All Superinterfaces:
IEolContext
,IErlContext
- All Known Subinterfaces:
IEvlContextParallel
- All Known Implementing Classes:
EvlContext
,EvlContextParallel
public interface IEvlContext extends IErlContext
-
-
Field Summary
Fields Modifier and Type Field Description static String
OPTIMIZE_CONSTRAINT_TRACE
static String
SHORT_CIRCUIT
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Set<Constraint>
getConstraintsDependedOn()
ConstraintTrace
getConstraintTrace()
Used internally to determine evaluated constraints.IEvlModule
getModule()
Casts the IModule to IEvlModuleCollection<UnsatisfiedConstraint>
getUnsatisfiedConstraints()
This collection is written to internally by the engine during execution.default Map<Constraint,Integer>
getUnsatisfiedConstraintsBySize()
default boolean
hasFixes()
boolean
isOptimizeConstraintTrace()
Return true if the constraint results cache is optimized.boolean
isShortCircuiting()
Option allowing validation to terminate early when any invariant is unsatisfied.void
setOptimizeConstraintTrace(boolean optimized)
Set the flag for using optimized contraint result caching.void
setShortCircuit(boolean shortCircuit)
Sets whether short-circuited validation is enabled.default boolean
shouldShortCircuit(Constraint constraint)
Checks whether the condition for short-circuiting is met, either by previous invocation returning true or if there are unsatisfied constraints and theisShortCircuiting()
flag is enabled, or if the specified module element has been annotated with a termination criteria and an unsatisfied constraint containing the type is already present.default Map<Constraint,Set<Object>>
sortUnsatisfiedConstraints()
default Set<UnsatisfiedConstraint>
uniqueUnsatisfiedConstraints()
This method is called internally once all constraints have been processed to convert the underlying collection ingetUnsatisfiedConstraints()
to a unique one.-
Methods inherited from interface org.eclipse.epsilon.eol.execute.context.IEolContext
dispose, getAsyncStatementsQueue, getErrorStream, getExtendedProperties, getFrameStack, getIntrospectionManager, getModelRepository, getNativeTypeDelegates, getOperationContributorRegistry, getOperationFactory, getOutputStream, getPrettyPrinterManager, getUserInput, getWarningStream, isAssertionsEnabled, isProfilingEnabled, setAssertionsEnabled, setErrorStream, setExecutorFactory, setExtendedProperties, setFrameStack, setIntrospectionManager, setModelRepository, setModule, setNativeTypeDelegates, setOperationFactory, setOutputStream, setPrettyPrinterManager, setProfilingEnabled, setUserInput, setWarningStream
-
Methods inherited from interface org.eclipse.epsilon.erl.execute.context.IErlContext
getExecutorFactory
-
-
-
-
Field Detail
-
OPTIMIZE_CONSTRAINT_TRACE
static final String OPTIMIZE_CONSTRAINT_TRACE
- Since:
- 1.6
- See Also:
- Constant Field Values
-
SHORT_CIRCUIT
static final String SHORT_CIRCUIT
- Since:
- 1.6
- See Also:
- Constant Field Values
-
-
Method Detail
-
getModule
IEvlModule getModule()
Casts the IModule to IEvlModule- Specified by:
getModule
in interfaceIEolContext
- Specified by:
getModule
in interfaceIErlContext
- Since:
- 1.6
- See Also:
IEolContext.getModule()
-
getUnsatisfiedConstraints
Collection<UnsatisfiedConstraint> getUnsatisfiedConstraints()
This collection is written to internally by the engine during execution. AlthoughIEvlModule.execute()
mandates the results to be a Set, for performance optimisation reasons this method is permitted to return any collection, so long as once execution is complete, the results contain no duplicates. This collection should therefore only be used to add elements, and is expected not to be queried during execution.- Returns:
- A mutable collection of unsatisfied Constraint-element pairs.
-
uniqueUnsatisfiedConstraints
default Set<UnsatisfiedConstraint> uniqueUnsatisfiedConstraints()
This method is called internally once all constraints have been processed to convert the underlying collection ingetUnsatisfiedConstraints()
to a unique one.- Returns:
- The final, filtered set of UnsatisfiedConstraints suitable for post-processing.
- Since:
- 1.6
-
getConstraintTrace
ConstraintTrace getConstraintTrace()
Used internally to determine evaluated constraints.- Returns:
- The checked Constraint-element pairs, or
null
if the trace is disabled.
-
isOptimizeConstraintTrace
boolean isOptimizeConstraintTrace()
Return true if the constraint results cache is optimized. When optimized, constraint results will only be cached during satisfies operation executions, that is, results will only be cached if required. If false, constraint results will always be cached.The default value is false;
- Returns:
- The value of the flag.
- Since:
- 1.6
-
setOptimizeConstraintTrace
void setOptimizeConstraintTrace(boolean optimized)
Set the flag for using optimized contraint result caching.- Parameters:
use
- Set to true to use optimzied contraint caching.- Since:
- 1.6
- See Also:
isOptimizeConstraintTrace()
-
isShortCircuiting
boolean isShortCircuiting()
Option allowing validation to terminate early when any invariant is unsatisfied.- Returns:
- Whether validation will stop once an UnsatisfiedConstraint is found.
- Since:
- 1.6
-
setShortCircuit
void setShortCircuit(boolean shortCircuit)
Sets whether short-circuited validation is enabled.- Parameters:
shortCircuit
- The new value for the flag.- Since:
- 1.6
-
shouldShortCircuit
default boolean shouldShortCircuit(Constraint constraint) throws EolRuntimeException
Checks whether the condition for short-circuiting is met, either by previous invocation returning true or if there are unsatisfied constraints and theisShortCircuiting()
flag is enabled, or if the specified module element has been annotated with a termination criteria and an unsatisfied constraint containing the type is already present.- Parameters:
Constraint
- The rule with the termination annotation.- Returns:
- Whether termination should be suspended.
- Throws:
EolRuntimeException
IllegalArgumentException
- If the rule parameter is not an appropriate type.- Since:
- 1.6
-
hasFixes
default boolean hasFixes()
- Returns:
- Since:
- 1.6
-
sortUnsatisfiedConstraints
default Map<Constraint,Set<Object>> sortUnsatisfiedConstraints()
- Returns:
- A mapping from a Constraint to all of its unsatisfied instances.
- Since:
- 1.6
-
getUnsatisfiedConstraintsBySize
default Map<Constraint,Integer> getUnsatisfiedConstraintsBySize()
- Returns:
- A sorted entry of Constraints with the number of unsatisfied instances, in descending order.
- Since:
- 1.6
-
getConstraintsDependedOn
default Set<Constraint> getConstraintsDependedOn()
- Returns:
- Since:
- 1.6
-
-