Package eu.bandm.tscore.base
Class Util.Pairwise<T>
java.lang.Object
eu.bandm.tscore.base.Util.Pairwise<T>
- Direct Known Subclasses:
SvgSource.ParamTranslate
,SvgSource.Process
- Enclosing class:
- Util
Visitor which performs the method
first(Object)
for the first element of an Iterable; afterwards the methodpairwise(Object,Object)
for each pair of adjacent elements, and at last the method last(Object)
.
DISLOC should be moved to metatools/ops/Iterators or metatools/util !?!?-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructor which does not assume the Iterator to be a ListIterator.Constructor which does not assume the Iterator to be a ListIterator.Pairwise
(ListIterator<T> lit) Constructor which assumes that the Iterator is a ListIterator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Can be overridden by the user to visit the very first element before the first pair is visited bypairwise(Object,Object)
.void
Can be overridden by the user to visit the very last element after the last pair is visited bypairwise(Object,Object)
.abstract void
Must be overridden by the user to visit the define what to do with each pair of adjacent elements.void
process()
Central public service provision to visit all wlements in the order of the given (List-) Iterator, executingfirst(Object)
,pairwise(Object,Object)
, andlast(Object)
in this sequential order.
-
Field Details
-
it
The iterator which drives the visiting order. -
lit
Identic toit
iff the constructor wihtListIterator
has been called. Otherwise null. -
_last
Internal register for the precedingly visited item.
-
-
Constructor Details
-
Pairwise
Constructor which does not assume the Iterator to be a ListIterator. -
Pairwise
Constructor which assumes that the Iterator is a ListIterator. -
Pairwise
Constructor which does not assume the Iterator to be a ListIterator.
-
-
Method Details
-
first
Can be overridden by the user to visit the very first element before the first pair is visited bypairwise(Object,Object)
. -
last
Can be overridden by the user to visit the very last element after the last pair is visited bypairwise(Object,Object)
. -
pairwise
Must be overridden by the user to visit the define what to do with each pair of adjacent elements. These are visited in the sequential order of the underlying Iterator. On Execution, that has berformed aIterator.next()
, so that it "points" (e.g. with itsIterator.hasNext()
to the successor of the later of both visited elements. -
process
public void process()Central public service provision to visit all wlements in the order of the given (List-) Iterator, executingfirst(Object)
,pairwise(Object,Object)
, andlast(Object)
in this sequential order.
-