Class Util.Pairwise<T>

java.lang.Object
eu.bandm.tscore.base.Util.Pairwise<T>
Direct Known Subclasses:
SvgSource.ParamTranslate, SvgSource.Process
Enclosing class:
Util

public abstract static class Util.Pairwise<T> extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    protected T
    Internal register for the precedingly visited item.
    protected final Iterator<T>
    The iterator which drives the visiting order.
    protected final @Opt ListIterator<T>
    Identic to it iff the constructor wiht ListIterator has been called.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor which does not assume the Iterator to be a ListIterator.
    Constructor which does not assume the Iterator to be a ListIterator.
    Constructor which assumes that the Iterator is a ListIterator.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    first(T t)
    Can be overridden by the user to visit the very first element before the first pair is visited by pairwise(Object,Object).
    void
    last(T t)
    Can be overridden by the user to visit the very last element after the last pair is visited by pairwise(Object,Object).
    abstract void
    pairwise(T t1, T t2)
    Must be overridden by the user to visit the define what to do with each pair of adjacent elements.
    void
    Central public service provision to visit all wlements in the order of the given (List-) Iterator, executing first(Object), pairwise(Object,Object), and last(Object) in this sequential order.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • it

      protected final Iterator<T> it
      The iterator which drives the visiting order.
    • lit

      @Opt protected final @Opt ListIterator<T> lit
      Identic to it iff the constructor wiht ListIterator has been called. Otherwise null.
    • _last

      protected T _last
      Internal register for the precedingly visited item.
  • Constructor Details

    • Pairwise

      public Pairwise(Iterable<T> it)
      Constructor which does not assume the Iterator to be a ListIterator.
    • Pairwise

      public Pairwise(ListIterator<T> lit)
      Constructor which assumes that the Iterator is a ListIterator.
    • Pairwise

      public Pairwise(Iterator<T> it)
      Constructor which does not assume the Iterator to be a ListIterator.
  • Method Details

    • first

      public void first(T t)
      Can be overridden by the user to visit the very first element before the first pair is visited by pairwise(Object,Object).
    • last

      public void last(T t)
      Can be overridden by the user to visit the very last element after the last pair is visited by pairwise(Object,Object).
    • pairwise

      public abstract void pairwise(T t1, T t2)
      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 a Iterator.next(), so that it "points" (e.g. with its Iterator.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, executing first(Object), pairwise(Object,Object), and last(Object) in this sequential order.