Interface Traverser<T>
- 
- All Superinterfaces:
- Cloneable,- Comparable<Traverser<T>>,- Serializable
 - All Known Subinterfaces:
- RemoteTraverser<T>,- Traverser.Admin<T>
 - All Known Implementing Classes:
- AbstractRemoteTraverser,- AbstractTraverser,- 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,- B_O_Traverser,- DefaultRemoteTraverser,- DummyTraverser,- EmptyTraverser,- 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,- O_Traverser,- ProjectedTraverser
 
 public interface Traverser<T> extends Serializable, Comparable<Traverser<T>>, Cloneable ATraverserrepresents the current state of an object flowing through aTraversal. A traverser maintains a reference to the current object, a traverser-local "sack", a traversal-global sideEffect, a bulk count, and a path history. Different types of traversers can exist depending on the semantics of the traversal and the desire for space/time optimizations of the developer.- Author:
- Marko A. Rodriguez (http://markorodriguez.com)
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static interfaceTraverser.Admin<T>The methods in System.Traverser are useful to underlying Step and Traversal implementations.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Traverser.Admin<T>asAdmin()Typecast the traverser to a "system traverser" soTraverser.Adminmethods can be accessed.longbulk()A traverser may represent a grouping of traversers to allow for more efficient data propagation.Traverser<T>clone()Traverser cloning is important when splitting a traverser at a bifurcation point in a traversal.default intcompareTo(Traverser<T> other)If the underlying object of the traverser is comparable, compare it with the other traverser.Tget()Get the object that the traverser is current at.intloops()Return the number of times the traverser has gone through a looping section of a traversal.intloops(String loopName)Return the number of times the traverser has gone through the named looping section of a traversal.Pathpath()Get the current path of the traverser.default <A> Apath(String stepLabel)Get the object associated with the specified step-label in the traverser's path history.default <A> Apath(Pop pop, String stepLabel)<S> Ssack()Get the sack local sack object of this traverser.<S> voidsack(S object)Set the traversers sack object to the provided value ("sack the value").default <A> AsideEffects(String sideEffectKey)Get a particular value from the side-effects of the traverser (thus, traversal).default voidsideEffects(String sideEffectKey, Object sideEffectValue)Add a particular value to the respective side-effect of the traverser (thus, traversal).
 
- 
- 
- 
Method Detail- 
getT get() Get the object that the traverser is current at.- Returns:
- The current object of the traverser
 
 - 
sack<S> S sack() Get the sack local sack object of this traverser.- Type Parameters:
- S- the type of the sack object
- Returns:
- the sack object
 
 - 
sack<S> void sack(S object) Set the traversers sack object to the provided value ("sack the value").- Type Parameters:
- S- the type of the object
- Parameters:
- object- the new value of the traverser's sack
 
 - 
pathPath path() Get the current path of the traverser.- Returns:
- The path of the traverser
 
 - 
pathdefault <A> A path(String stepLabel) Get the object associated with the specified step-label in the traverser's path history.- Type Parameters:
- A- the type of the object
- Parameters:
- stepLabel- the step-label in the path to access
- Returns:
- the object associated with that path label (if more than one object occurs at that step, a list is returned)
 
 - 
loopsint loops() Return the number of times the traverser has gone through a looping section of a traversal.- Returns:
- The number of times the traverser has gone through a loop
 
 - 
loopsint loops(String loopName) Return the number of times the traverser has gone through the named looping section of a traversal.- Parameters:
- loopName- the name applied to the loop or null for the containing loop
- Returns:
- The number of times the traverser has gone through a loop
- Throws:
- IllegalArgumentException- if the loopName is not defined
 
 - 
bulklong bulk() A traverser may represent a grouping of traversers to allow for more efficient data propagation.- Returns:
- the number of traversers represented in this traverser.
 
 - 
sideEffectsdefault <A> A sideEffects(String sideEffectKey) throws IllegalArgumentException Get a particular value from the side-effects of the traverser (thus, traversal).- Type Parameters:
- A- the type of the returned object
- Parameters:
- sideEffectKey- the key of the value to get from the sideEffects
- Returns:
- the object in the sideEffects of the respective key
- Throws:
- IllegalArgumentException
 
 - 
sideEffectsdefault void sideEffects(String sideEffectKey, Object sideEffectValue) throws IllegalArgumentException Add a particular value to the respective side-effect of the traverser (thus, traversal).- Parameters:
- sideEffectKey- the key of the value to set int the sideEffects
- sideEffectValue- the value to set for the sideEffect key
- Throws:
- IllegalArgumentException
 
 - 
compareTodefault int compareTo(Traverser<T> other) throws ClassCastException If the underlying object of the traverser is comparable, compare it with the other traverser.- Specified by:
- compareToin interface- Comparable<T>
- Parameters:
- other- the other traverser that presumably has a comparable internal object
- Returns:
- the comparison of the two objects of the traversers
- Throws:
- ClassCastException- if the object of the traverser is not comparable
 
 - 
asAdmindefault Traverser.Admin<T> asAdmin() Typecast the traverser to a "system traverser" soTraverser.Adminmethods can be accessed. This is used as a helper method to avoid the awkwardness of((Traverser.Administrative)traverser). The default implementation simply returns "this" type casted toTraverser.Admin.- Returns:
- The type-casted traverser
 
 
- 
 
-