Interface NL_SL_Traverser<T>

All Superinterfaces:
Attachable<T>, Cloneable, Comparable<Traverser<T>>, Serializable, Traverser<T>, Traverser.Admin<T>
All Known Implementing Classes:
B_LP_NL_O_P_S_SE_SL_Traverser, B_LP_NL_O_S_SE_SL_Traverser, B_LP_O_P_S_SE_SL_Traverser, B_LP_O_S_SE_SL_Traverser, B_NL_O_S_SE_SL_Traverser, B_O_S_SE_SL_Traverser, LP_NL_O_OB_P_S_SE_SL_Traverser, LP_NL_O_OB_S_SE_SL_Traverser, LP_O_OB_P_S_SE_SL_Traverser, LP_O_OB_S_SE_SL_Traverser, NL_O_OB_S_SE_SL_Traverser, O_OB_S_SE_SL_Traverser

public interface NL_SL_Traverser<T> extends Traverser.Admin<T>
Intermediate helper interface for Traversers that support loops. Implementations are expected to override either the single or nested loop functions depending on the type of loop TraverserRequirement they are using.

Note: it would be nice to separate the TraverserRequirement.SINGLE_LOOP vs TraverserRequirement.NESTED_LOOP logic into different traverser interfaces in the future however the current Traverser class hierarchy makes that difficult as Traversers that support nested loops extend from Traversers that support single loops but override all single loop logic with nested loop logic.

  • Method Details

    • getLoopRequirement

      TraverserRequirement getLoopRequirement()
      Returns:
      the supported loop type - either TraverserRequirement.NESTED_LOOP or TraverserRequirement.SINGLE_LOOP
    • getNestedLoops

      default Stack<LabelledCounter> getNestedLoops()
      Override this method to support nested loops.
      Returns:
      the Stack of LabelledCounter which holds the nested loops.
    • getNestedLoopNames

      default org.apache.commons.collections4.map.ReferenceMap<String,Object> getNestedLoopNames()
      Override this method to support nested loops.
      Returns:
      the ReferenceMap where key=loop name and value=reference to the LabelledCounter.
    • getSingleLoopCount

      default short getSingleLoopCount()
      Override this method to support single loop.
      Returns:
      the single loop count.
    • setSingleLoopCount

      default void setSingleLoopCount(short loops)
      Override this method to support single loop. Sets the single loop count.
    • getSingleLoopName

      default String getSingleLoopName()
      Override this method to support single loop.
      Returns:
      the single loop name.
    • setSingleLoopName

      default void setSingleLoopName(String loopName)
      Override this method to support single loop. Sets the single loop name.
    • getSingleLoopStepLabel

      default String getSingleLoopStepLabel()
      Override this method to support single loop.
      Returns:
      the single loop step label.
    • setSingleLoopStepLabel

      default void setSingleLoopStepLabel(String stepLabel)
      Override this method to support single loop. Sets the single loop step label.
    • incrLoops

      default void incrLoops()
      Description copied from interface: Traverser.Admin
      Increment the number of times the traverser has gone through a looping section of traversal.
      Specified by:
      incrLoops in interface Traverser.Admin<T>
    • loops

      default int loops()
      Description copied from interface: Traverser
      Return the number of times the traverser has gone through a looping section of a traversal.
      Specified by:
      loops in interface Traverser<T>
      Returns:
      the current loop count for single loops or the latest loop count for nested loops.
    • loops

      default int loops(String loopName)
      Obtain a loop count for a named loop or for the current loop count for single loops or the latest loop count for nested loops.
      Specified by:
      loops in interface Traverser<T>
      Parameters:
      loopName - the optional name applied to the loop
      Returns:
      the count for the loop identified by the given loopName or current loop count for single loops or latest loop for nested loops.
    • initialiseLoops

      default void initialiseLoops(String stepLabel, String loopName)
      Initialises loops depending on the getLoopRequirement() loop type.
      Specified by:
      initialiseLoops in interface Traverser.Admin<T>
      Parameters:
      stepLabel - the label of the step initialising the loops.
      loopName - the optional user defined name for referencing the loop counter
    • resetLoops

      default void resetLoops()
      Resets loops depending on the getLoopRequirement() loop type.
      Specified by:
      resetLoops in interface Traverser.Admin<T>
    • getLoopNames

      default Set<String> getLoopNames()
      Description copied from interface: Traverser.Admin
      If this traverser supports loops then return the loop names if any.
      Specified by:
      getLoopNames in interface Traverser.Admin<T>
      Returns:
      the loop names that can be used to reference loops.
    • getValidLoopRequirement

      default TraverserRequirement getValidLoopRequirement()
    • initialiseNestedLoops

      default void initialiseNestedLoops(String stepLabel, String loopName)
    • getNestedLoopCount

      default int getNestedLoopCount(String loopName)
    • copyNestedLoops

      default void copyNestedLoops(Stack<LabelledCounter> targetNestedLoops, org.apache.commons.collections4.map.ReferenceMap<String,Object> targetLoopNames)