Interface Traverser.Admin<T>
-
- All Superinterfaces:
org.apache.tinkerpop.gremlin.structure.util.Attachable<T>
,Cloneable
,Comparable<Traverser<T>>
,Serializable
,Traverser<T>
public static interface Traverser.Admin<T> extends Traverser<T>, org.apache.tinkerpop.gremlin.structure.util.Attachable<T>
The methods in System.Traverser are useful to underlying Step and Traversal implementations. They should not be accessed by the user during lambda-based manipulations.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.util.Attachable
org.apache.tinkerpop.gremlin.structure.util.Attachable.Exceptions, org.apache.tinkerpop.gremlin.structure.util.Attachable.Method
-
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traverser
Traverser.Admin<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addLabels(Set<String> labels)
T
attach(Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<T>,T> method)
Regenerate the detached traverser given its location at a particular vertex.Traverser.Admin<T>
detach()
Prepare the traverser for migration across a JVM boundary.void
dropLabels(Set<String> labels)
Drop all path information associated with specified labels.void
dropPath()
Drop the path of the traverser.TraversalSideEffects
getSideEffects()
Get the sideEffects associated with the traversal of the traverser.String
getStepId()
Get the step id of where the traverser is located.Set<String>
getTags()
Get the tags associated with the traverser.void
incrLoops()
Increment the number of times the traverser has gone through a looping section of traversal.void
initialiseLoops(String stepLabel, String loopName)
Initialise a loop by setting up the looping construct.default boolean
isHalted()
If the traverser has "no future" then it is done with its lifecycle.void
keepLabels(Set<String> labels)
Drop all path information not associated with specified labels.void
merge(Traverser.Admin<?> other)
When two traversers are have equality with each other, then they can be merged.void
resetLoops()
Set the number of times the traverser has gone through a loop back to 0.void
set(T t)
Set the current object location of the traverser.void
setBulk(long count)
Set the number of traversers represented by this traverser.void
setSideEffects(TraversalSideEffects sideEffects)
Set the sideEffects of theTraversal
.void
setStepId(String stepId)
Set the step id of where the traverser is located.Traverser.Admin<T>
split()
Generate a sibling traverser of the current traverser with a full copy of all state within the sibling.<R> Traverser.Admin<R>
split(R r, Step<T,R> step)
Generate a child traverser of the current traverser for current as step and new object location.
-
-
-
Field Detail
-
HALT
static final String HALT
- See Also:
- Constant Field Values
-
-
Method Detail
-
merge
void merge(Traverser.Admin<?> other)
When two traversers are have equality with each other, then they can be merged. This method is used to merge the traversers into a single traverser. This is used for optimization where instead of enumerating all traversers, they can be counted.- Parameters:
other
- the other traverser to merge into this traverser. Once merged, the other can be garbage collected.
-
split
<R> Traverser.Admin<R> split(R r, Step<T,R> step)
Generate a child traverser of the current traverser for current as step and new object location. The child has the path history, future, and loop information of the parent. The child extends that path history with the current as and provided R-object.- Type Parameters:
R
- The current object type of the child- Parameters:
r
- The current object of the childstep
- The step yielding the split- Returns:
- The split traverser
-
split
Traverser.Admin<T> split()
Generate a sibling traverser of the current traverser with a full copy of all state within the sibling.- Returns:
- The split traverser
-
keepLabels
void keepLabels(Set<String> labels)
Drop all path information not associated with specified labels. This is an optimization method that allows a traverser to save memory and increase the likelihood of bulking.- Parameters:
labels
- the labels to keep path information for.
-
dropLabels
void dropLabels(Set<String> labels)
Drop all path information associated with specified labels. This is an optimization method that allows a traverser to save memory and increase the likelihood of bulking.- Parameters:
labels
- the labels to drop path information for.
-
dropPath
void dropPath()
Drop the path of the traverser. This is an optimization method that allows a traverser to save memory and increase the likelihood of bulking.
-
set
void set(T t)
Set the current object location of the traverser.- Parameters:
t
- The current object of the traverser
-
initialiseLoops
void initialiseLoops(String stepLabel, String loopName)
Initialise a loop by setting up the looping construct. The step label is important to create a stack of loop counters when within a nested context. If the provided label is not the same as the current label on the stack, add a new loop counter. The loopName can be used to refer to the loops counter via theLoopsStep
- Parameters:
stepLabel
- the label of the step that is being set-up.loopName
- the user defined name for referencing the loop counter or null if not set
-
incrLoops
void incrLoops()
Increment the number of times the traverser has gone through a looping section of traversal.
-
resetLoops
void resetLoops()
Set the number of times the traverser has gone through a loop back to 0. When a traverser exits a looping construct, this method should be called. In a nested loop context, the highest stack loop counter should be removed.
-
getStepId
String getStepId()
Get the step id of where the traverser is located. This is typically used in multi-machine systems that require the movement of traversers between different traversal instances.- Returns:
- The future step for the traverser
-
setStepId
void setStepId(String stepId)
Set the step id of where the traverser is located. If the future isHALT
, thenisHalted()
is true.- Parameters:
stepId
- The future step of the traverser
-
isHalted
default boolean isHalted()
If the traverser has "no future" then it is done with its lifecycle. This does not mean that the traverser is "dead," only that it has successfully passed through aTraversal
.- Returns:
- Whether the traverser is done executing or not
-
setBulk
void setBulk(long count)
Set the number of traversers represented by this traverser.- Parameters:
count
- the number of traversers
-
detach
Traverser.Admin<T> detach()
Prepare the traverser for migration across a JVM boundary.- Returns:
- The deflated traverser
-
attach
T attach(Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<T>,T> method)
Regenerate the detached traverser given its location at a particular vertex.- Specified by:
attach
in interfaceorg.apache.tinkerpop.gremlin.structure.util.Attachable<T>
- Parameters:
method
- The method by which to attach aTraverser
to an vertex.- Returns:
- The inflated traverser
-
setSideEffects
void setSideEffects(TraversalSideEffects sideEffects)
Set the sideEffects of theTraversal
. Given that traversers can move between machines, it may be important to re-set this when the traverser crosses machine boundaries.- Parameters:
sideEffects
- the sideEffects of the traversal.
-
getSideEffects
TraversalSideEffects getSideEffects()
Get the sideEffects associated with the traversal of the traverser.- Returns:
- the traversal sideEffects of the traverser
-
-