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.
 void dispose()
           
 java.lang.Object evaluateBody()
          Evaluate the iteration body for the current iterators and return the evaluation result.
 java.lang.Object get()
          Get the current state of the iterator.
 java.lang.Object getAccumulatorValue()
          Get the current state of the accumulator.
 DomainEvaluator getEvaluator()
           
 CollectionValue getSourceCollection()
          Return the source collection over which this (nested) iteration iterates.
 DomainStandardLibrary getStandardLibrary()
           
 boolean hasCurrent()
          Return true if the iterators have a step to be evaluated.
 java.lang.Object updateAccumulator(java.lang.Object newValue)
          Update the accumulator witrh the result of a body iteration.
 

Method Detail

advanceIterators

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


createNestedIterationManager

@NonNull
DomainIterationManager createNestedIterationManager(@NonNull
                                                            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

dispose

void dispose()

evaluateBody

@Nullable
java.lang.Object 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.

Throws:
java.lang.Exception

get

@Nullable
java.lang.Object get()
Get the current state of the iterator.
This is only supported for single iterator iterations.


getAccumulatorValue

@Nullable
java.lang.Object getAccumulatorValue()
Get the current state of the accumulator.


getEvaluator

@NonNull
DomainEvaluator getEvaluator()

getSourceCollection

@NonNull
CollectionValue getSourceCollection()
Return the source collection over which this (nested) iteration iterates.


getStandardLibrary

@NonNull
DomainStandardLibrary getStandardLibrary()

hasCurrent

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


updateAccumulator

@Nullable
java.lang.Object updateAccumulator(java.lang.Object newValue)
Update the accumulator witrh the result of a body iteration.
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:
java.lang.Exception
InvalidValueException