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 forTraversers that support loops. Implementations are expected to override either the single or nested loop functions depending on the type of loopTraverserRequirementthey are using.Note: it would be nice to separate the
TraverserRequirement.SINGLE_LOOPvsTraverserRequirement.NESTED_LOOPlogic into different traverser interfaces in the future however the currentTraverserclass hierarchy makes that difficult asTraversers that support nested loops extend fromTraversers that support single loops but override all single loop logic with nested loop logic.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.util.Attachable
Attachable.Exceptions, Attachable.Method
-
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traverser
Traverser.Admin<T>
-
-
Field Summary
-
Fields inherited from interface org.apache.tinkerpop.gremlin.structure.util.Attachable
logger
-
Fields inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traverser.Admin
HALT
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidcopyNestedLoops(Stack<LabelledCounter> targetNestedLoops, org.apache.commons.collections.map.ReferenceMap targetLoopNames)default Set<String>getLoopNames()If this traverser supports loops then return the loop names if any.TraverserRequirementgetLoopRequirement()default intgetNestedLoopCount(String loopName)default org.apache.commons.collections.map.ReferenceMapgetNestedLoopNames()Override this method to support nested loops.default Stack<LabelledCounter>getNestedLoops()Override this method to support nested loops.default shortgetSingleLoopCount()Override this method to support single loop.default StringgetSingleLoopName()Override this method to support single loop.default StringgetSingleLoopStepLabel()Override this method to support single loop.default TraverserRequirementgetValidLoopRequirement()default voidincrLoops()Increment the number of times the traverser has gone through a looping section of traversal.default voidinitialiseLoops(String stepLabel, String loopName)Initialises loops depending on thegetLoopRequirement()loop type.default voidinitialiseNestedLoops(String stepLabel, String loopName)default intloops()Return the number of times the traverser has gone through a looping section of a traversal.default intloops(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.default voidresetLoops()Resets loops depending on thegetLoopRequirement()loop type.default voidsetSingleLoopCount(short loops)Override this method to support single loop.default voidsetSingleLoopName(String loopName)Override this method to support single loop.default voidsetSingleLoopStepLabel(String stepLabel)Override this method to support single loop.-
Methods inherited from interface org.apache.tinkerpop.gremlin.structure.util.Attachable
get
-
Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traverser
asAdmin, bulk, clone, compareTo, get, path, path, path, sack, sack, sideEffects, sideEffects
-
Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traverser.Admin
addLabels, attach, detach, dropLabels, dropPath, getSideEffects, getStepId, getTags, isHalted, keepLabels, merge, set, setBulk, setSideEffects, setStepId, split, split
-
-
-
-
Method Detail
-
getLoopRequirement
TraverserRequirement getLoopRequirement()
- Returns:
- the supported loop type - either
TraverserRequirement.NESTED_LOOPorTraverserRequirement.SINGLE_LOOP
-
getNestedLoops
default Stack<LabelledCounter> getNestedLoops()
Override this method to support nested loops.- Returns:
- the
StackofLabelledCounterwhich holds the nested loops.
-
getNestedLoopNames
default org.apache.commons.collections.map.ReferenceMap getNestedLoopNames()
Override this method to support nested loops.- Returns:
- the
ReferenceMapwhere key=loop name and value=reference to theLabelledCounter.
-
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.AdminIncrement the number of times the traverser has gone through a looping section of traversal.- Specified by:
incrLoopsin interfaceTraverser.Admin<T>
-
loops
default int loops()
Description copied from interface:TraverserReturn the number of times the traverser has gone through a looping section of a traversal.
-
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.
-
initialiseLoops
default void initialiseLoops(String stepLabel, String loopName)
Initialises loops depending on thegetLoopRequirement()loop type.- Specified by:
initialiseLoopsin interfaceTraverser.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 thegetLoopRequirement()loop type.- Specified by:
resetLoopsin interfaceTraverser.Admin<T>
-
getLoopNames
default Set<String> getLoopNames()
Description copied from interface:Traverser.AdminIf this traverser supports loops then return the loop names if any.- Specified by:
getLoopNamesin interfaceTraverser.Admin<T>- Returns:
- the loop names that can be used to reference loops.
-
getValidLoopRequirement
default TraverserRequirement getValidLoopRequirement()
-
getNestedLoopCount
default int getNestedLoopCount(String loopName)
-
copyNestedLoops
default void copyNestedLoops(Stack<LabelledCounter> targetNestedLoops, org.apache.commons.collections.map.ReferenceMap targetLoopNames)
-
-