Class EvlContext

All Implemented Interfaces:
IEolContext, IErlContext, IEvlContext

public class EvlContext extends ErlContext implements IEvlContext
  • Field Details

    • unsatisfiedConstraints

      protected Collection<UnsatisfiedConstraint> unsatisfiedConstraints
    • constraintTrace

      protected ConstraintTrace constraintTrace
    • optimizeConstraintTrace

      protected boolean optimizeConstraintTrace
    • shortCircuiting

      protected boolean shortCircuiting
    • terminate

      protected boolean terminate
  • Constructor Details

    • EvlContext

      public EvlContext()
    • EvlContext

      public EvlContext(IEvlContext other)
      Copy constructor, intended for internal use only.
      Parameters:
      other - The parent context.
      Since:
      1.6
  • Method Details

    • getConstraintTrace

      public ConstraintTrace getConstraintTrace()
      Description copied from interface: IEvlContext
      Used internally to determine evaluated constraints.
      Specified by:
      getConstraintTrace in interface IEvlContext
      Returns:
      The checked Constraint-element pairs, or null if the trace is disabled.
    • uniqueUnsatisfiedConstraints

      public Set<UnsatisfiedConstraint> uniqueUnsatisfiedConstraints()
      Description copied from interface: IEvlContext
      This method is called internally once all constraints have been processed to convert the underlying collection in IEvlContext.getUnsatisfiedConstraints() to a unique one.
      Specified by:
      uniqueUnsatisfiedConstraints in interface IEvlContext
      Returns:
      The final, filtered set of UnsatisfiedConstraints suitable for post-processing.
    • getUnsatisfiedConstraints

      public Collection<UnsatisfiedConstraint> getUnsatisfiedConstraints()
      Description copied from interface: IEvlContext
      This collection is written to internally by the engine during execution. Although IEvlModule.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:
      getUnsatisfiedConstraints in interface IEvlContext
      Returns:
      A mutable collection of unsatisfied Constraint-element pairs.
    • getModule

      public IEvlModule getModule()
      Description copied from interface: IErlContext
      Casts the IModule to IErlModule
      Specified by:
      getModule in interface IEolContext
      Specified by:
      getModule in interface IErlContext
      Specified by:
      getModule in interface IEvlContext
      Overrides:
      getModule in class ErlContext
      See Also:
    • setOptimizeConstraintTrace

      public void setOptimizeConstraintTrace(boolean optimize)
      Description copied from interface: IEvlContext
      Set the flag for using optimized contraint result caching.
      Specified by:
      setOptimizeConstraintTrace in interface IEvlContext
      See Also:
    • isOptimizeConstraintTrace

      public boolean isOptimizeConstraintTrace()
      Description copied from interface: IEvlContext
      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;

      Specified by:
      isOptimizeConstraintTrace in interface IEvlContext
      Returns:
      The value of the flag.
    • isShortCircuiting

      public boolean isShortCircuiting()
      Description copied from interface: IEvlContext
      Option allowing validation to terminate early when any invariant is unsatisfied.
      Specified by:
      isShortCircuiting in interface IEvlContext
      Returns:
      Whether validation will stop once an UnsatisfiedConstraint is found.
    • setShortCircuit

      public void setShortCircuit(boolean shortCircuit)
      Description copied from interface: IEvlContext
      Sets whether short-circuited validation is enabled.
      Specified by:
      setShortCircuit in interface IEvlContext
      Parameters:
      shortCircuit - The new value for the flag.
    • shouldShortCircuit

      public boolean shouldShortCircuit(Constraint constraint) throws EolRuntimeException
      Description copied from interface: IEvlContext
      Checks whether the condition for short-circuiting is met, either by previous invocation returning true or if there are unsatisfied constraints and the IEvlContext.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:
      shouldShortCircuit in interface IEvlContext
      Returns:
      Whether termination should be suspended.
      Throws:
      EolRuntimeException
    • dispose

      public void dispose()
      Specified by:
      dispose in interface IEolContext
      Overrides:
      dispose in class EolContext