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
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.util.Attachable
Attachable.Exceptions, Attachable.MethodNested 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
loggerFields inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traverser.Admin
HALT -
Method Summary
Modifier and TypeMethodDescriptiondefault voidcopyNestedLoops(Stack<LabelledCounter> targetNestedLoops, org.apache.commons.collections4.map.ReferenceMap<String, Object> targetLoopNames) If this traverser supports loops then return the loop names if any.default intgetNestedLoopCount(String loopName) Override this method to support nested loops.default Stack<LabelledCounter>Override this method to support nested loops.default shortOverride this method to support single loop.default StringOverride this method to support single loop.default StringOverride this method to support single loop.default TraverserRequirementdefault voidIncrement 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 intObtain 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 voidResets 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
getMethods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traverser
asAdmin, bulk, clone, compareTo, get, path, path, path, sack, sack, sideEffects, sideEffectsMethods 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 Details
-
getLoopRequirement
TraverserRequirement getLoopRequirement()- Returns:
- the supported loop type - either
TraverserRequirement.NESTED_LOOPorTraverserRequirement.SINGLE_LOOP
-
getNestedLoops
Override this method to support nested loops.- Returns:
- the
StackofLabelledCounterwhich holds the nested loops.
-
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
Override this method to support single loop.- Returns:
- the single loop name.
-
setSingleLoopName
Override this method to support single loop. Sets the single loop name. -
getSingleLoopStepLabel
Override this method to support single loop.- Returns:
- the single loop step label.
-
setSingleLoopStepLabel
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
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
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
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
-
initialiseNestedLoops
-
getNestedLoopCount
-
copyNestedLoops
default void copyNestedLoops(Stack<LabelledCounter> targetNestedLoops, org.apache.commons.collections4.map.ReferenceMap<String, Object> targetLoopNames)
-