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

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

public class SortedByIteration
extends AbstractIteration<SortedByIteration.SortingValue>

SelectIteration realises the Collection::sortedBy() library iteration.

Since:
3.1

Nested Class Summary
protected static class SortedByIteration.SortingValue
           
 
Field Summary
static SortedByIteration INSTANCE
           
 
Constructor Summary
SortedByIteration()
           
 
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 resolveTerminalValue(IterationManager<SortedByIteration.SortingValue> iterationManager)
          Return the value appropriate to an iteration over all the source elements.
protected  Value updateAccumulator(IterationManager<SortedByIteration.SortingValue> iterationManager)
          Update the accumulatorValue with the bodyValue resulting from the current iteration for which the iterators define the context in the environment.
 org.eclipse.emf.common.util.Diagnostic validate(TypeManager typeManager, CallExp callExp)
           
 
Methods inherited from class org.eclipse.ocl.examples.library.AbstractIteration
createAccumulationValue, evaluate, evaluateIteration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final SortedByIteration INSTANCE
Constructor Detail

SortedByIteration

public SortedByIteration()
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

resolveTerminalValue

protected Value resolveTerminalValue(IterationManager<SortedByIteration.SortingValue> iterationManager)
Description copied from class: AbstractIteration
Return the value appropriate to an iteration over all the source elements. The default implementation just returns the accumulator. Derived iterations should override.

Overrides:
resolveTerminalValue in class AbstractIteration<SortedByIteration.SortingValue>
Parameters:
iterationManager - the iteration context
Returns:

updateAccumulator

protected Value updateAccumulator(IterationManager<SortedByIteration.SortingValue> 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<SortedByIteration.SortingValue>
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