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

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

public class SortedByIteration
extends AbstractIteration

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


Nested Class Summary
protected static class SortedByIteration.SortingValue
           
 
Field Summary
static SortedByIteration INSTANCE
           
 
Constructor Summary
SortedByIteration()
           
 
Method Summary
 SortedByIteration.SortingValue createAccumulatorValue(DomainEvaluator evaluator, DomainType accumulatorType, DomainType bodyType)
          Create the value that will accumulate the iteration results.
 LibraryValidator getValidator(DomainStandardLibrary standardLibrary)
          Return a validator for a CallExp using this feature.
protected  Value resolveTerminalValue(DomainIterationManager iterationManager)
          Return the final result at the end of an iteration over all the source elements.
protected  Value updateAccumulator(DomainIterationManager 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.domain.library.AbstractIteration
evaluateIteration
 
Methods inherited from class org.eclipse.ocl.examples.domain.library.AbstractFeature
getLibraryValidator
 
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

createAccumulatorValue

public SortedByIteration.SortingValue createAccumulatorValue(DomainEvaluator evaluator,
                                                             DomainType accumulatorType,
                                                             DomainType bodyType)
                                                      throws InvalidValueException
Description copied from interface: LibraryIteration
Create the value that will accumulate the iteration results.

Parameters:
evaluator - that supervises evaluation
Returns:
the accumulator
Throws:
InvalidValueException

getValidator

public LibraryValidator getValidator(DomainStandardLibrary standardLibrary)
Description copied from interface: LibraryFeature
Return a validator for a CallExp using this feature. May return null for no validator. Validation occurs during analysis with the pivot model using facilities that are not needed for evaluation. This method enables a pivot-unaware evaluation plugin to load a validator from a pivot-aware plugin without imposing a pivot dependency.

Specified by:
getValidator in interface LibraryFeature
Overrides:
getValidator in class AbstractFeature
Parameters:
standardLibrary - a context to assist in class loading.
Returns:

resolveTerminalValue

protected Value resolveTerminalValue(DomainIterationManager iterationManager)
Description copied from class: AbstractIteration
Return the final result at the end of an iteration over all the source elements. The default implementation just returns the accumulator. Derived iterations should override.
This method is bypassed if the iteration ends prematurely.

Overrides:
resolveTerminalValue in class AbstractIteration
Parameters:
iterationManager - the iteration context
Returns:
the result

updateAccumulator

protected Value updateAccumulator(DomainIterationManager 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
Parameters:
iterationManager - the iteration context
Returns:
non-null premature result of iteration, or null if complete