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
public class EvlContext extends ErlContext implements IEvlContext
-
-
Field Summary
Fields Modifier and Type Field Description protected ConstraintTraceconstraintTraceprotected booleanoptimizeConstraintTraceprotected booleanshortCircuitingprotected booleanterminateprotected java.util.Collection<UnsatisfiedConstraint>unsatisfiedConstraints-
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, userInput, warningStream
-
Fields inherited from interface org.eclipse.epsilon.evl.execute.context.IEvlContext
OPTIMIZE_CONSTRAINT_TRACE, SHORT_CIRCUIT
-
-
Constructor Summary
Constructors Constructor Description EvlContext()EvlContext(IEvlContext other)Copy constructor, intended for internal use only.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()ConstraintTracegetConstraintTrace()Used internally to determine evaluated constraints.IEvlModulegetModule()Casts the IModule to IErlModulejava.util.Collection<UnsatisfiedConstraint>getUnsatisfiedConstraints()This collection is written to internally by the engine during execution.booleanisOptimizeConstraintTrace()Return true if the constraint results cache is optimized.booleanisShortCircuiting()Option 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.java.util.Set<UnsatisfiedConstraint>uniqueUnsatisfiedConstraints()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, setProfilingEnabled
-
Methods inherited from class org.eclipse.epsilon.eol.execute.context.EolContext
getAsyncStatementsQueue, getErrorStream, getExtendedProperties, getFrameStack, getIntrospectionManager, getModelRepository, getNativeTypeDelegates, getOperationContributorRegistry, getOperationFactory, getOutputStream, getPrettyPrinterManager, getUserInput, getWarningStream, isAssertionsEnabled, isProfilingEnabled, setAssertionsEnabled, setErrorStream, setExtendedProperties, setFrameStack, setIntrospectionManager, setModelRepository, setModule, setNativeTypeDelegates, setOperationFactory, setOutputStream, setPrettyPrinterManager, setUserInput, setWarningStream
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.epsilon.eol.execute.context.IEolContext
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
-
Methods inherited from interface org.eclipse.epsilon.evl.execute.context.IEvlContext
getConstraintsDependedOn, getUnsatisfiedConstraintsBySize, hasFixes, sortUnsatisfiedConstraints
-
-
-
-
Field Detail
-
unsatisfiedConstraints
protected java.util.Collection<UnsatisfiedConstraint> unsatisfiedConstraints
-
constraintTrace
protected ConstraintTrace constraintTrace
-
optimizeConstraintTrace
protected boolean optimizeConstraintTrace
-
shortCircuiting
protected boolean shortCircuiting
-
terminate
protected boolean terminate
-
-
Constructor Detail
-
EvlContext
public EvlContext()
-
EvlContext
public EvlContext(IEvlContext other)
Copy constructor, intended for internal use only.- Parameters:
other- The parent context.- Since:
- 1.6
-
-
Method Detail
-
getConstraintTrace
public ConstraintTrace 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
public java.util.Set<UnsatisfiedConstraint> 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
public java.util.Collection<UnsatisfiedConstraint> 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
public IEvlModule 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:
IEolContext.getModule()
-
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:
IEvlContext.isOptimizeConstraintTrace()
-
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
public boolean shouldShortCircuit(Constraint constraint) throws EolRuntimeException
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
-
-