Class EvlContext
java.lang.Object
org.eclipse.epsilon.eol.execute.context.EolContext
org.eclipse.epsilon.erl.execute.context.ErlContext
org.eclipse.epsilon.evl.execute.context.EvlContext
- All Implemented Interfaces:
IEolContext,IErlContext,IEvlContext
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConstraintTraceprotected booleanprotected booleanprotected booleanprotected Collection<UnsatisfiedConstraint> Fields inherited from class org.eclipse.epsilon.eol.execute.context.EolContext
assertionsEnabled, asyncStatementsQueue, classpathNativeTypeDelegate, errorStream, executorFactory, extendedProperties, frameStack, introspectionManager, methodContributorRegistry, modelRepository, module, nativeTypeDelegates, operationFactory, outputStream, prettyPrinterManager, profilingEnabled, uriResolvers, userInput, warningStreamFields inherited from interface org.eclipse.epsilon.evl.execute.context.IEvlContext
OPTIMIZE_CONSTRAINT_TRACE, SHORT_CIRCUIT -
Constructor Summary
ConstructorsConstructorDescriptionEvlContext(IEvlContext other) Copy constructor, intended for internal use only. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Used internally to determine evaluated constraints.Casts the IModule to IErlModuleThis collection is written to internally by the engine during execution.booleanReturn true if the constraint results cache is optimized.booleanOption allowing validation to terminate early when any invariant is unsatisfied.voidsetOptimizeConstraintTrace(boolean optimize) Set the flag for using optimized contraint result caching.voidsetShortCircuit(boolean shortCircuit) Sets whether short-circuited validation is enabled.booleanshouldShortCircuit(Constraint constraint) Checks whether the condition for short-circuiting is met, either by previous invocation returning true or if there are unsatisfied constraints and theIEvlContext.isShortCircuiting()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.This method is called internally once all constraints have been processed to convert the underlying collection inIEvlContext.getUnsatisfiedConstraints()to a unique one.Methods inherited from class org.eclipse.epsilon.erl.execute.context.ErlContext
getExecutorFactory, setExecutorFactory, setProfilingEnabledMethods inherited from class org.eclipse.epsilon.eol.execute.context.EolContext
getAsyncStatementsQueue, getErrorStream, getExtendedProperties, getFrameStack, getIntrospectionManager, getModelRepository, getNativeTypeDelegates, getOperationContributorRegistry, getOperationFactory, getOutputStream, getPrettyPrinterManager, getURIResolvers, getUserInput, getWarningStream, isAssertionsEnabled, isProfilingEnabled, setAssertionsEnabled, setErrorStream, setExtendedProperties, setFrameStack, setIntrospectionManager, setModelRepository, setModule, setNativeTypeDelegates, setOperationFactory, setOutputStream, setPrettyPrinterManager, setUserInput, setWarningStreamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.epsilon.eol.execute.context.IEolContext
getAsyncStatementsQueue, getErrorStream, getExtendedProperties, getFrameStack, getIntrospectionManager, getModelRepository, getNativeTypeDelegates, getOperationContributorRegistry, getOperationFactory, getOutputStream, getPrettyPrinterManager, getURIResolvers, getUserInput, getWarningStream, isAssertionsEnabled, isProfilingEnabled, setAssertionsEnabled, setErrorStream, setExecutorFactory, setExtendedProperties, setFrameStack, setIntrospectionManager, setModelRepository, setModule, setNativeTypeDelegates, setOperationFactory, setOutputStream, setPrettyPrinterManager, setProfilingEnabled, setUserInput, setWarningStreamMethods inherited from interface org.eclipse.epsilon.erl.execute.context.IErlContext
getExecutorFactoryMethods inherited from interface org.eclipse.epsilon.evl.execute.context.IEvlContext
getConstraintsDependedOn, getUnsatisfiedConstraintsBySize, hasFixes, sortUnsatisfiedConstraints
-
Field Details
-
unsatisfiedConstraints
-
constraintTrace
-
optimizeConstraintTrace
protected boolean optimizeConstraintTrace -
shortCircuiting
protected boolean shortCircuiting -
terminate
protected boolean terminate
-
-
Constructor Details
-
EvlContext
public EvlContext() -
EvlContext
Copy constructor, intended for internal use only.- Parameters:
other- The parent context.- Since:
- 1.6
-
-
Method Details
-
getConstraintTrace
Description copied from interface:IEvlContextUsed internally to determine evaluated constraints.- Specified by:
getConstraintTracein interfaceIEvlContext- Returns:
- The checked Constraint-element pairs, or
nullif the trace is disabled.
-
uniqueUnsatisfiedConstraints
Description copied from interface:IEvlContextThis method is called internally once all constraints have been processed to convert the underlying collection inIEvlContext.getUnsatisfiedConstraints()to a unique one.- Specified by:
uniqueUnsatisfiedConstraintsin interfaceIEvlContext- Returns:
- The final, filtered set of UnsatisfiedConstraints suitable for post-processing.
-
getUnsatisfiedConstraints
Description copied from interface:IEvlContextThis 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.- Specified by:
getUnsatisfiedConstraintsin interfaceIEvlContext- Returns:
- A mutable collection of unsatisfied Constraint-element pairs.
-
getModule
Description copied from interface:IErlContextCasts the IModule to IErlModule- Specified by:
getModulein interfaceIEolContext- Specified by:
getModulein interfaceIErlContext- Specified by:
getModulein interfaceIEvlContext- Overrides:
getModulein classErlContext- See Also:
-
setOptimizeConstraintTrace
public void setOptimizeConstraintTrace(boolean optimize) Description copied from interface:IEvlContextSet the flag for using optimized contraint result caching.- Specified by:
setOptimizeConstraintTracein interfaceIEvlContext- See Also:
-
isOptimizeConstraintTrace
public boolean isOptimizeConstraintTrace()Description copied from interface:IEvlContextReturn 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;
- Specified by:
isOptimizeConstraintTracein interfaceIEvlContext- Returns:
- The value of the flag.
-
isShortCircuiting
public boolean isShortCircuiting()Description copied from interface:IEvlContextOption allowing validation to terminate early when any invariant is unsatisfied.- Specified by:
isShortCircuitingin interfaceIEvlContext- Returns:
- Whether validation will stop once an UnsatisfiedConstraint is found.
-
setShortCircuit
public void setShortCircuit(boolean shortCircuit) Description copied from interface:IEvlContextSets whether short-circuited validation is enabled.- Specified by:
setShortCircuitin interfaceIEvlContext- Parameters:
shortCircuit- The new value for the flag.
-
shouldShortCircuit
Description copied from interface:IEvlContextChecks whether the condition for short-circuiting is met, either by previous invocation returning true or if there are unsatisfied constraints and theIEvlContext.isShortCircuiting()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.- Specified by:
shouldShortCircuitin interfaceIEvlContext- Returns:
- Whether termination should be suspended.
- Throws:
EolRuntimeException
-
dispose
public void dispose()- Specified by:
disposein interfaceIEolContext- Overrides:
disposein classEolContext
-