public abstract class AbstractIteration extends AbstractFeature implements LibraryIteration
Modifier and Type | Class and Description |
---|---|
static class |
AbstractIteration.MutableObject
A MutableObject may be used as an iteration accumulatior containing a single changing value.
|
Modifier and Type | Field and Description |
---|---|
protected static java.lang.Object |
CARRY_ON
An out-of-band value that can be returned by
updateAccumulator(org.eclipse.ocl.pivot.evaluation.IterationManager) to signal
that the iteration should carry on rather than terminate using the returned value. |
EMPTY_BAG, EMPTY_SET, FALSE_VALUE, INTEGER_MAX_VALUE, INTEGER_MIN_VALUE, INVALID_VALUE, LONG_MAX_VALUE, LONG_MIN_VALUE, NULL_STRING, NULL_VALUE, ONE_VALUE, TRUE_VALUE, UNLIMITED_ONE_VALUE, UNLIMITED_VALUE, ZERO_VALUE
Constructor and Description |
---|
AbstractIteration() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
evaluateIteration(IterationManager iterationManager)
The default iteration algorithm steps through the iteration domain by invoking
IterationManager.hasCurrent() and IterationManager.advanceIterators() . |
protected java.lang.Object |
resolveTerminalValue(IterationManager iterationManager)
Return the final result at the end of an iteration over all the source elements.
|
protected abstract java.lang.Object |
updateAccumulator(IterationManager iterationManager)
Update the accumulatorValue with the bodyValue resulting from the current iteration
for which the iterators define the context in the environment.
|
asBagValue, asBoolean, asClass, asCollectionType, asCollectionValue, asInteger, asIntegerValue, asMapType, asMapValue, asNavigableObject, asObject, asOrderedCollectionValue, asOrderedSetValue, asRealValue, asSequenceValue, asSetValue, asString, asTupleValue, asType, asUniqueCollectionValue, asUnlimitedNaturalValue, asValue, bigDecimalValueOf, bigIntegerValueOf, characterValueOf, createBagAccumulatorValue, createBagOfEach, createBagRange, createBagValue, createCollectionAccumulatorValue, createInvalidValue, createMapEntry, createMapOfEach, createMapValue, createObjectValue, createOrderedSetAccumulatorValue, createOrderedSetOfEach, createOrderedSetRange, createOrderedSetValue, createRange, createSequenceAccumulatorValue, createSequenceOfEach, createSequenceRange, createSequenceRange, createSequenceValue, createSetAccumulatorValue, createSetOfEach, createSetRange, createSetValue, createTupleOfEach, createTupleValue, getElementIdName, getTypeName, initAllStatics, integerValueOf, integerValueOf, integerValueOf, integerValueOf, integerValueOf, isBoxed, isCollectionValue, isEcore, isIntegerNumber, isIntegerValue, isRealNumber, isUnboxed, isUnlimited, oclToString, realValueOf, realValueOf, realValueOf, realValueOf, realValueOf, stringValueOf, throwBooleanInvalidValueException, throwInvalidValueException, throwUnsupportedCompareTo, toString, unlimitedNaturalValueOf, unlimitedNaturalValueOf, unlimitedNaturalValueOf, unlimitedNaturalValueOf, unlimitedNaturalValueOf
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createAccumulatorValue
@NonNull protected static final java.lang.Object CARRY_ON
updateAccumulator(org.eclipse.ocl.pivot.evaluation.IterationManager)
to signal
that the iteration should carry on rather than terminate using the returned value.@Nullable public java.lang.Object evaluateIteration(@NonNull IterationManager iterationManager)
IterationManager.hasCurrent()
and IterationManager.advanceIterators()
.
At each step updateAccumulator(IterationManager)
is invoked to update the
accumulator for that step. A non-null return causes a premature exit and forms the
return from the overall evaluation. If all steps complete resolveTerminalValue(IterationManager)
is invoked to provide the return value.
Derived classes may override this method to change the iteration algorithm or override the call-backs to customize the default iteration.
evaluateIteration
in interface LibraryIteration
iterationManager
- the iteration spacejava.lang.Exception
@Nullable protected java.lang.Object resolveTerminalValue(@NonNull IterationManager iterationManager)
iterationManager
- the iteration context@Nullable protected abstract java.lang.Object updateAccumulator(@NonNull IterationManager iterationManager)
iterationManager
- the iteration contextjava.lang.Exception