org.eclipse.ocl.examples.library.executor
Class ExecutorSingleIterationManager

java.lang.Object
  extended by org.eclipse.ocl.examples.domain.library.AbstractIterationManager
      extended by org.eclipse.ocl.examples.library.executor.ExecutorSingleIterationManager
All Implemented Interfaces:
DomainIterationManager

public class ExecutorSingleIterationManager
extends AbstractIterationManager


Field Summary
protected  LibraryBinaryOperation body
           
protected  java.util.Iterator<Value> iteratorValue
           
protected  DomainType returnType
           
 
Fields inherited from class org.eclipse.ocl.examples.domain.library.AbstractIterationManager
evaluator
 
Constructor Summary
ExecutorSingleIterationManager(DomainEvaluator evaluator, DomainType returnType, LibraryBinaryOperation body, CollectionValue collectionValue, Value accumulatorValue)
           
 
Method Summary
 boolean advanceIterators()
          Advance the iterators to the next iteration, returning false once all possible iterator states have been exhausted.
 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.
 boolean hasCurrent()
          Return true if the iterators have a step to be evaluated.
 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.
 
Methods inherited from class org.eclipse.ocl.examples.domain.library.AbstractIterationManager
createNestedIterationManager, getValueFactory, isOuterIteration, throwInvalidEvaluation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

returnType

protected final DomainType returnType

body

protected final LibraryBinaryOperation body

iteratorValue

protected final java.util.Iterator<Value> iteratorValue
Constructor Detail

ExecutorSingleIterationManager

public ExecutorSingleIterationManager(DomainEvaluator evaluator,
                                      DomainType returnType,
                                      LibraryBinaryOperation body,
                                      CollectionValue collectionValue,
                                      Value accumulatorValue)
Method Detail

advanceIterators

public boolean advanceIterators()
Description copied from interface: DomainIterationManager
Advance the iterators to the next iteration, returning false once all possible iterator states have been exhausted.


get

public Value get()
Description copied from interface: DomainIterationManager
Get the current state of the iterator.
This is only supported for single iterator iterations.

Specified by:
get in interface DomainIterationManager
Overrides:
get in class AbstractIterationManager

getAccumulatorValue

public Value getAccumulatorValue()
Description copied from interface: DomainIterationManager
Get the current state of the accumulator.


evaluateBody

public Value evaluateBody()
Description copied from interface: DomainIterationManager
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.


hasCurrent

public boolean hasCurrent()
Description copied from interface: DomainIterationManager
Return true if the iterators have a step to be evaluated.


throwInvalidEvaluation

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

updateBody

public Value updateBody()
                 throws InvalidValueException
Description copied from interface: DomainIterationManager
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