org.eclipse.ocl.examples.library
Class AbstractIteration<ACC extends Value>

java.lang.Object
  extended by org.eclipse.ocl.examples.library.AbstractFeature
      extended by org.eclipse.ocl.examples.library.AbstractIteration<ACC>
All Implemented Interfaces:
LibraryFeature, LibraryIteration, CallableImplementation
Direct Known Subclasses:
AnyIteration, ClosureIteration, CollectIteration, CollectNestedIteration, ExistsIteration, ForAllIteration, IsUniqueIteration, IterateIteration, OneIteration, RejectIteration, SelectIteration, SortedByIteration

public abstract class AbstractIteration<ACC extends Value>
extends AbstractFeature
implements LibraryIteration

AbstractIteration realises shared characteristics of library iterations.

Since:
3.1

Constructor Summary
AbstractIteration()
           
 
Method Summary
protected  CollectionValue.Accumulator createAccumulationValue(ValueFactory valueFactory, boolean isOrdered, boolean isUnique)
           
 Value evaluate(EvaluationVisitor evaluationVisitor, Value sourceValue, CallExp callExp)
           
protected  Value evaluateIteration(IterationManager<ACC> iterationManager)
           
protected  Value resolveTerminalValue(IterationManager<ACC> iterationManager)
          Return the value appropriate to an iteration over all the source elements.
protected abstract  Value updateAccumulator(IterationManager<ACC> 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.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.library.LibraryIteration
evaluate
 
Methods inherited from interface org.eclipse.ocl.examples.pivot.evaluation.CallableImplementation
validate
 

Constructor Detail

AbstractIteration

public AbstractIteration()
Method Detail

createAccumulationValue

protected CollectionValue.Accumulator createAccumulationValue(ValueFactory valueFactory,
                                                              boolean isOrdered,
                                                              boolean isUnique)

evaluate

public Value evaluate(EvaluationVisitor evaluationVisitor,
                      Value sourceValue,
                      CallExp callExp)
Description copied from interface: CallableImplementation

Specified by:
evaluate in interface CallableImplementation

evaluateIteration

protected Value evaluateIteration(IterationManager<ACC> iterationManager)

resolveTerminalValue

protected Value resolveTerminalValue(IterationManager<ACC> iterationManager)
Return the value appropriate to an iteration over all the source elements. The default implementation just returns the accumulator. Derived iterations should override.

Parameters:
iterationManager - the iteration context
Returns:
Throws:
InvalidEvaluationException

updateAccumulator

protected abstract Value updateAccumulator(IterationManager<ACC> iterationManager)
Update the accumulatorValue with the bodyValue resulting from the current iteration for which the iterators define the context in the environment.

Parameters:
iterationManager - the iteration context
Returns:
non-null premature result of iteration, or null if complete
Throws:
InvalidEvaluationException