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  CollectionValue collectionValue
           
protected  java.util.Iterator<? extends java.lang.Object> iteratorValue
           
protected  TypeId returnTypeId
           
 
Fields inherited from class org.eclipse.ocl.examples.domain.library.AbstractIterationManager
evaluator
 
Constructor Summary
  ExecutorSingleIterationManager(DomainEvaluator evaluator, TypeId returnTypeId, LibraryBinaryOperation body, CollectionValue value, java.lang.Object accumulatorValue)
           
protected ExecutorSingleIterationManager(ExecutorSingleIterationManager iterationManager, CollectionValue collectionValue)
           
 
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.
 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.
 int getDepth()
           
 ExecutorSingleIterationManager getRootIterationManager()
           
 CollectionValue getSourceCollection()
          Return the source collection over which this (nested) iteration iterates.
 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.
 
Methods inherited from class org.eclipse.ocl.examples.domain.library.AbstractIterationManager
dispose, getEvaluator, getStandardLibrary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

collectionValue

@NonNull
protected final CollectionValue collectionValue

returnTypeId

@NonNull
protected final TypeId returnTypeId

body

@NonNull
protected final LibraryBinaryOperation body

iteratorValue

@NonNull
protected final java.util.Iterator<? extends java.lang.Object> iteratorValue
Constructor Detail

ExecutorSingleIterationManager

public ExecutorSingleIterationManager(@NonNull
                                      DomainEvaluator evaluator,
                                      @NonNull
                                      TypeId returnTypeId,
                                      @NonNull
                                      LibraryBinaryOperation body,
                                      @Nullable
                                      CollectionValue value,
                                      @Nullable
                                      java.lang.Object accumulatorValue)

ExecutorSingleIterationManager

protected ExecutorSingleIterationManager(@NonNull
                                         ExecutorSingleIterationManager iterationManager,
                                         @NonNull
                                         CollectionValue collectionValue)
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.


createNestedIterationManager

@NonNull
public DomainIterationManager createNestedIterationManager(@NonNull
                                                                   CollectionValue value)
Description copied from interface: DomainIterationManager
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.

Specified by:
createNestedIterationManager in interface DomainIterationManager
Overrides:
createNestedIterationManager in class AbstractIterationManager
Parameters:
value - the nested iteration domain
Returns:
the iteration space

evaluateBody

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


get

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

@Nullable
public java.lang.Object getAccumulatorValue()
Description copied from interface: DomainIterationManager
Get the current state of the accumulator.


getDepth

public int getDepth()

getRootIterationManager

@NonNull
public ExecutorSingleIterationManager getRootIterationManager()

getSourceCollection

@NonNull
public CollectionValue getSourceCollection()
Description copied from interface: DomainIterationManager
Return the source collection over which this (nested) iteration iterates.


hasCurrent

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


updateAccumulator

@Nullable
public java.lang.Object updateAccumulator(java.lang.Object newValue)
Description copied from interface: DomainIterationManager
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.