org.eclipse.ocl.examples.library.iterator
Class CollectIteration

java.lang.Object
  extended by org.eclipse.ocl.examples.library.AbstractFeature
      extended by org.eclipse.ocl.examples.library.AbstractIteration<CollectionValue.Accumulator>
          extended by org.eclipse.ocl.examples.library.iterator.CollectIteration
All Implemented Interfaces:
LibraryFeature, LibraryIteration, CallableImplementation

public class CollectIteration
extends AbstractIteration<CollectionValue.Accumulator>

CollectIteration realises the Collection::collect() library iteration.

Since:
3.1

Field Summary
static CollectIteration INSTANCE
           
 
Constructor Summary
CollectIteration()
           
 
Method Summary
 Value evaluate(EvaluationVisitor evaluationVisitor, CollectionValue sourceVal, LoopExp iteratorExp)
          Return the result of evaluating iterationCall upon sourceVal within the environment provided by EvaluationVisitor.
protected  Value updateAccumulator(IterationManager<CollectionValue.Accumulator> iterationManager)
          Update the accumulatorValue with the bodyValue resulting from the current iteration for which the iterators define the context in the environment.
 
Methods inherited from class org.eclipse.ocl.examples.library.AbstractIteration
createAccumulationValue, evaluate, evaluateIteration, resolveTerminalValue
 
Methods inherited from class org.eclipse.ocl.examples.library.AbstractFeature
validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.evaluation.CallableImplementation
validate
 

Field Detail

INSTANCE

public static final CollectIteration INSTANCE
Constructor Detail

CollectIteration

public CollectIteration()
Method Detail

evaluate

public Value evaluate(EvaluationVisitor evaluationVisitor,
                      CollectionValue sourceVal,
                      LoopExp iteratorExp)
Description copied from interface: LibraryIteration
Return the result of evaluating iterationCall upon sourceVal within the environment provided by EvaluationVisitor. An invalid return may be indicated by throwing an exception returning Java null or OCL invalid.

Parameters:
evaluationVisitor - the evaluation context
sourceVal - the source operand for the operation
iteratorExp - the iteration and additional arguments
Returns:
the evaluated value

updateAccumulator

protected Value updateAccumulator(IterationManager<CollectionValue.Accumulator> iterationManager)
Description copied from class: AbstractIteration
Update the accumulatorValue with the bodyValue resulting from the current iteration for which the iterators define the context in the environment.

Specified by:
updateAccumulator in class AbstractIteration<CollectionValue.Accumulator>
Parameters:
iterationManager - the iteration context
Returns:
non-null premature result of iteration, or null if complete