Class Iterators.Triplewise<T>

java.lang.Object
eu.bandm.tools.util.java.Iterators.Triplewise<T>
Enclosing class:
Iterators

public abstract static class Iterators.Triplewise<T> extends Object
Visitor which performs the method action(Object,Object,Object) for triples of adjacent elements of an Iterable. The references wander through the positions, from the third to the first. The schema for a four element list is as follows:
      null null #0
      null #0   #1
      #0   #1   #2
      #1   #2   #3
      #2   #3   null
      #3   null null
  
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Iterator<T>
    eviden
    protected T
    The middle of the three visited instances (in the sequential order of the visitor).
    protected T
    The first of the three visited instances (in the sequential order of the visitor).
    protected T
    The last of the three visited instances (in the sequential order of the visitor).
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    evident
    protected
    evident
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    action(T left, T middle, T right)
    Call back to be overwritten by the user.
    void
    Executes all the invocations of with the argument combinations described in the table above.

    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
      eviden
    • t

      protected T t
      The last of the three visited instances (in the sequential order of the visitor). Will be the last parameter in the invocation of action(T, T, T). Will be ==null for the last two invocations, see the table above.
    • last

      protected T last
      The middle of the three visited instances (in the sequential order of the visitor). Will be the midle parameter in the invocations of action(T, T, T). Will be ==null for the first and the last invocation, see the table above.
    • lastlast

      protected T lastlast
      The first of the three visited instances (in the sequential order of the visitor). Will be the first parameter in the invocations of action(T, T, T). Will be ==null for the first two invocation, see the table above.
  • Constructor Details

    • Triplewise

      protected Triplewise(Iterable<T> it)
      evident
    • Triplewise

      protected Triplewise(Iterator<T> it)
      evident
  • Method Details

    • action

      public abstract void action(@Opt T left, @Opt T middle, @Opt T right)
      Call back to be overwritten by the user. Define here what to do on the invocations which follow the table above.
    • visit

      public void visit()
      Executes all the invocations of with the argument combinations described in the table above.