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

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.ClosureIteration
All Implemented Interfaces:
LibraryFeature, LibraryIteration, CallableImplementation

public class ClosureIteration
extends AbstractIteration<CollectionValue.Accumulator>

ClosureIteration realizes the Collection::closure() library iteration.

Since:
3.1

Field Summary
static ClosureIteration INSTANCE
           
 
Constructor Summary
ClosureIteration()
           
 
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)
          Recursively evaluates the iterator body expression.
 org.eclipse.emf.common.util.Diagnostic validate(TypeManager typeManager, CallExp callExp)
           
 
Methods inherited from class org.eclipse.ocl.examples.library.AbstractIteration
createAccumulationValue, evaluate, evaluateIteration, resolveTerminalValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final ClosureIteration INSTANCE
Constructor Detail

ClosureIteration

public ClosureIteration()
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)
Recursively evaluates the iterator body expression.

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

validate

public org.eclipse.emf.common.util.Diagnostic validate(TypeManager typeManager,
                                                       CallExp callExp)
Specified by:
validate in interface CallableImplementation
Overrides:
validate in class AbstractFeature