S
- The incoming object type of the stepE
- The outgoing object type of the steppublic interface Step<S,E> extends Iterator<Traverser.Admin<E>>, Serializable, Cloneable
Step
denotes a unit of computation within a Traversal
.
A step takes an incoming object and yields an outgoing object.
Steps are chained together in a Traversal
to yield a lazy function chain of computation.
In the constructor of a Step, never store explicit sideEffect objects in TraversalSideEffects
.
If a sideEffect needs to be registered with the Traversal
, use SideEffects.registerSupplier().Modifier and Type | Method and Description |
---|---|
void |
addLabel(String label)
Add a label to this step.
|
void |
addStart(Traverser.Admin<S> start)
Add a single
Traverser.Admin to the step. |
void |
addStarts(Iterator<Traverser.Admin<S>> starts)
Add an iterator of
Traverser.Admin objects of type S to the step. |
Step<S,E> |
clone()
Cloning is used to duplicate steps for the purpose of traversal optimization and OLTP replication.
|
default boolean |
equals(Step other,
boolean compareIds)
Compare the current step with another step.
|
String |
getId()
Get the unique id of this step.
|
Set<String> |
getLabels()
Get the labels of this step.
|
Step<E,?> |
getNextStep()
Get the next step to the current step.
|
Step<?,S> |
getPreviousStep()
Get the step prior to the current step.
|
default Set<TraverserRequirement> |
getRequirements()
Provide the necessary
TraverserRequirement that must be met by the traverser in order for the step to
function properly. |
<A,B> Traversal.Admin<A,B> |
getTraversal()
Get the
Traversal.Admin that this step is contained within. |
boolean |
hasStarts()
Determines if starts objects are present without iterating forward.
|
void |
removeLabel(String label)
Remove a label from this step.
|
void |
reset()
Reset the state of the step such that it has no incoming starts.
|
void |
setId(String id)
Get the unique id of the step.
|
void |
setNextStep(Step<E,?> step)
Set the step that is next to the current step.
|
void |
setPreviousStep(Step<?,S> step)
Set the step that is previous to the current step.
|
void |
setTraversal(Traversal.Admin<?,?> traversal)
Set the
Traversal that this step is contained within. |
forEachRemaining, hasNext, next, remove
void addStarts(Iterator<Traverser.Admin<S>> starts)
Traverser.Admin
objects of type S to the step.starts
- The iterator of objects to addvoid addStart(Traverser.Admin<S> start)
Traverser.Admin
to the step.start
- The traverser to addboolean hasStarts()
ReducingBarrierStep
implementations where they always return true
for calls to
Iterator.hasNext()
. Using this function gives insight to what the step itself is holding in its iterator without
performing any sort of processing on the step itself.void setPreviousStep(Step<?,S> step)
step
- the previous step of this stepStep<?,S> getPreviousStep()
void setNextStep(Step<E,?> step)
step
- the next step of this step<A,B> Traversal.Admin<A,B> getTraversal()
Traversal.Admin
that this step is contained within.A
- The incoming object type of the traversalB
- The outgoing object type of the traversalvoid setTraversal(Traversal.Admin<?,?> traversal)
Traversal
that this step is contained within.traversal
- the new traversal for this stepvoid reset()
Step<S,E> clone()
reset()
is called. Moreover, the previous and next steps should be set to EmptyStep
.Set<String> getLabels()
addLabel(java.lang.String)
.void addLabel(String label)
label
- the label to add to this stepvoid removeLabel(String label)
label
- the label to remove from this stepvoid setId(String id)
id
- the unique id of the stepString getId()
default Set<TraverserRequirement> getRequirements()
TraverserRequirement
that must be met by the traverser in order for the step to
function properly. The provided default implements returns an empty set.default boolean equals(Step other, boolean compareIds)
other
- the other stepcompareIds
- whether to compare step IDs or notCopyright © 2013–2022 Apache Software Foundation. All rights reserved.