org.eclipse.ocl.examples.domain.evaluation
Interface DomainIterationManager

All Known Implementing Classes:
AbstractIterationManager, EvaluatorIterationManager, EvaluatorMultipleIterationManager, EvaluatorSingleIterationManager, ExecutorDoubleIterationManager, ExecutorSingleIterationManager

public interface DomainIterationManager

DomainIterationManager defines the supervisor for an iteration. It provides a body, one or more iterators and an accumulator, which may be updated by evaluating the body.


Method Summary
 boolean advanceIterators()
          Advance the iterators to the next iteration, returning false once all possible iterator states have been exhausted.
 DomainIterationManager createNestedIterationManager(CollectionValue value)
          Create a nested iteration supervisor.
 Value evaluateBody()
          Evaluate the iteration body for the current iterators and return the evaluation result.
 Value get()
          Get the current state of the iterator.
 Value getAccumulatorValue()
          Get the current state of the accumulator.
 ValueFactory getValueFactory()
          Get the factory for values.
 boolean hasCurrent()
          Return true if the iterators have a step to be evaluated.
 boolean isOuterIteration()
          Get the current iteration depth.
 NullValue throwInvalidEvaluation(InvalidValueException e)
           
 NullValue throwInvalidEvaluation(java.lang.String message, java.lang.Object... bindings)
           
 Value updateBody()
          Evaluate the iteration body for the current iterators and update the accumulator accordingly.
 

Method Detail

advanceIterators

boolean advanceIterators()
Advance the iterators to the next iteration, returning false once all possible iterator states have been exhausted.


createNestedIterationManager

DomainIterationManager createNestedIterationManager(CollectionValue value)
Create a nested iteration supervisor.
This method supports the closure iteration for which there is only a single iterator, and so this method need only be supported by single iterator managers.

Parameters:
value - the nested iteration domain
Returns:
the iteration space
Throws:
InvalidValueException

evaluateBody

Value evaluateBody()
Evaluate the iteration body for the current iterators and return the evaluation result.
This is used by non-iterate iteration that intervene between the body evaluation and accumulator update.


get

Value get()
Get the current state of the iterator.
This is only supported for single iterator iterations.


getAccumulatorValue

Value getAccumulatorValue()
Get the current state of the accumulator.


getValueFactory

ValueFactory getValueFactory()
Get the factory for values.


hasCurrent

boolean hasCurrent()
Return true if the iterators have a step to be evaluated.


isOuterIteration

boolean isOuterIteration()
Get the current iteration depth.
This is only supported for single iterator recursive iterations such as closure.


throwInvalidEvaluation

NullValue throwInvalidEvaluation(java.lang.String message,
                                 java.lang.Object... bindings)
                                 throws InvalidEvaluationException
Throws:
InvalidEvaluationException

throwInvalidEvaluation

NullValue throwInvalidEvaluation(InvalidValueException e)

updateBody

Value updateBody()
                 throws InvalidValueException
Evaluate the iteration body for the current iterators and update the accumulator accordingly.
This implements the body of an iterate iteration for which the accumulator value may be assigned to a completely independent value. Returns null for the iteration to continue, non-null to terminate.

Throws:
InvalidValueException