Interface VoidIteration
-
- All Known Subinterfaces:
ValueIteration<R>
- All Known Implementing Classes:
IteratorInstance
public interface VoidIteration
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Object
NULL
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
doBreak()
Break the current recursion level, if last level then same asdoReturn()
void
doBreak(int recursionLevel)
Break out of given recursion levelvoid
doComplete()
Complete current iteration, ie.default void
doContinue()
Continue with next iteration of current recursion levelvoid
doContinue(int recursionLevel)
Continue with the next iteration of the given recursion levelvoid
doReturn()
Break out of all recursion levels and return current result value for the loop if value loopint
getAcceptCount()
MutableDataHolder
getData()
Per loop instance data instance can be used to store context informationboolean
getHaveAcceptableNext()
boolean
getHaveNext()
int
getLoopCount()
int
getRecursionLevel()
int
getTotalAcceptCount()
int
getTotalLoopCount()
void
ifIncomplete(java.lang.Runnable runnable)
Run the passed code only if the current iteration is not completeboolean
isComplete()
boolean
isIncomplete()
boolean
isTerminated()
-
-
-
Method Detail
-
doComplete
void doComplete()
Complete current iteration, ie. isComplete() will report true and isIncomplete() falsePurely a convenience feature to use without needing to track if break or continue have been executed
-
doContinue
void doContinue(int recursionLevel)
Continue with the next iteration of the given recursion level- Parameters:
recursionLevel
- 0 current, <0 previous recursion levels, gt;0 actual recursion level
-
doBreak
void doBreak(int recursionLevel)
Break out of given recursion level- Parameters:
recursionLevel
- 0 current, lt;0 previous recursion levels, gt;0 actual recursion level
-
doReturn
void doReturn()
Break out of all recursion levels and return current result value for the loop if value loop
-
doContinue
default void doContinue()
Continue with next iteration of current recursion level
-
doBreak
default void doBreak()
Break the current recursion level, if last level then same asdoReturn()
-
getHaveNext
boolean getHaveNext()
- Returns:
- true if have next element, does not mean it matches filters, just raw next from loop iterator, fast check
-
getHaveAcceptableNext
boolean getHaveAcceptableNext()
- Returns:
- true if have next element and it passes element filters.
NOTE:
ValueIterationConsumerAdapter
not invoked. It is part of the consumer.accept() call hierarchy and can have code side-effects. Only predicate filters are tested. This does not mean the final consumer will see this value.
-
isTerminated
boolean isTerminated()
- Returns:
- true if looping terminated by
doReturn()
, ordoBreak()
of the last recursion level.
-
isComplete
boolean isComplete()
- Returns:
- true if current iteration is complete ie. had ( Break(), Continue(), Return(), Complete())
-
isIncomplete
boolean isIncomplete()
- Returns:
- true if current iteration is not complete, ie. need to continue processing
-
ifIncomplete
void ifIncomplete(@NotNull java.lang.Runnable runnable)
Run the passed code only if the current iteration is not complete- Parameters:
runnable
- to run
-
getLoopCount
int getLoopCount()
- Returns:
- times through the loop of the current recursion level, includes skipped elements due to filtering
-
getAcceptCount
int getAcceptCount()
- Returns:
- total times consumer was invoked, ie. valid elements
-
getTotalLoopCount
int getTotalLoopCount()
- Returns:
- current loop count across all recursions
-
getTotalAcceptCount
int getTotalAcceptCount()
- Returns:
- accept count across all recursions
-
getRecursionLevel
int getRecursionLevel()
- Returns:
- count of recursion level, can use in Break(recursionLevel) or Continue(recursionLevel) to break/continue a particular recursion
-
getData
MutableDataHolder getData()
Per loop instance data instance can be used to store context informationExists between
VoidIterationConsumer.beforeStart(VoidIteration)
andValueIterationConsumer.afterEnd(ValueIteration)
for consumer andlifetime of
IteratorInstance
for caller ofTreeIterator.iterate(N, R, com.vladsch.flexmark.tree.iteration.ValueIterationConsumer<? super N, R>)
- Returns:
- per loop instance mutable data holder
-
-