Interface Step<S,E>
-
- Type Parameters:
S
- The incoming object type of the stepE
- The outgoing object type of the step
- All Superinterfaces:
Cloneable
,Iterator<Traverser.Admin<E>>
,Serializable
- All Known Implementing Classes:
AbstractStep
,AddEdgeStartStep
,AddEdgeStep
,AddPropertyStep
,AddVertexStartStep
,AddVertexStep
,AggregateGlobalStep
,AggregateLocalStep
,AllStep
,AndStep
,AnyStep
,AsDateStep
,AsStringStep
,BranchStep
,CallStep
,ChooseStep
,ClassFilterStep
,CoalesceStep
,CoinStep
,CollectingBarrierStep
,CombineStep
,ComputerAwareStep
,ComputerAwareStep.EndStep
,ComputerResultStep
,ConcatStep
,ConjoinStep
,ConnectedComponentVertexProgramStep
,ConnectiveStep
,ConstantStep
,CountGlobalStep
,CountLocalStep
,DateAddStep
,DateDiffStep
,DedupGlobalStep
,DedupLocalStep
,DifferenceStep
,DisjunctStep
,DropStep
,EdgeOtherVertexStep
,EdgeVertexStep
,ElementMapStep
,ElementStep
,EmptyStep
,FailStep
,FilterStep
,FlatMapStep
,FoldStep
,GraphStep
,GroupCountSideEffectStep
,GroupCountStep
,GroupSideEffectStep
,GroupStep
,HasNextStep
,HasStep
,IdentityStep
,IdStep
,IndexStep
,InjectStep
,IntersectStep
,IoStep
,IsStep
,LabelStep
,LambdaCollectingBarrierStep
,LambdaFilterStep
,LambdaFlatMapStep
,LambdaMapStep
,LambdaSideEffectStep
,LengthStep
,LocalStep
,LoopsStep
,LTrimStep
,MapStep
,MatchStep
,MatchStep.MatchEndStep
,MatchStep.MatchStartStep
,MathStep
,MaxGlobalStep
,MaxLocalStep
,MeanGlobalStep
,MeanLocalStep
,MergeEdgeStep
,MergeStep
,MergeVertexStep
,MinGlobalStep
,MinLocalStep
,NoneStep
,NoOpBarrierStep
,NotStep
,OptionalStep
,OrderGlobalStep
,OrderLocalStep
,OrStep
,PageRankVertexProgramStep
,PathFilterStep
,PathStep
,PeerPressureVertexProgramStep
,ProductStep
,ProfileSideEffectStep
,ProfileStep
,ProfileTest.MockStep
,ProgramVertexProgramStep
,ProjectStep
,PropertiesStep
,PropertyKeyStep
,PropertyMapStep
,PropertyValueStep
,RangeGlobalStep
,RangeLocalStep
,ReducingBarrierStep
,ReferenceElementStrategy.ReferenceElementStep
,RemoteStep
,RepeatStep
,RepeatStep.RepeatEndStep
,ReplaceStep
,RequirementsStep
,ReverseStep
,RTrimStep
,SackStep
,SackValueStep
,SampleGlobalStep
,SampleLocalStep
,ScalarMapStep
,SelectOneStep
,SelectStep
,ShortestPathVertexProgramStep
,SideEffectCapStep
,SideEffectStep
,SplitStep
,StartStep
,SubgraphStep
,SubstringStep
,SumGlobalStep
,SumLocalStep
,SupplyingBarrierStep
,TailGlobalStep
,TailLocalStep
,TimeLimitStep
,TinkerCountGlobalStep
,TinkerGraphStep
,ToLowerStep
,ToUpperStep
,TraversalFilterStep
,TraversalFlatMapStep
,TraversalMapStep
,TraversalMergeStep
,TraversalSelectStep
,TraversalSideEffectStep
,TraversalVertexProgramStep
,TreeSideEffectStep
,TreeStep
,TrimStep
,UnfoldStep
,UnionStep
,VertexProgramStep
,VertexStep
,WherePredicateStep
,WhereTraversalStep
,WhereTraversalStep.WhereEndStep
,WhereTraversalStep.WhereStartStep
public interface Step<S,E> extends Iterator<Traverser.Admin<E>>, Serializable, Cloneable
AStep
denotes a unit of computation within aTraversal
. A step takes an incoming object and yields an outgoing object. Steps are chained together in aTraversal
to yield a lazy function chain of computation. In the constructor of a Step, never store explicit sideEffect objects inTraversalSideEffects
. If a sideEffect needs to be registered with theTraversal
, use SideEffects.registerSupplier().
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addLabel(String label)
Add a label to this step.void
addStart(Traverser.Admin<S> start)
Add a singleTraverser.Admin
to the step.void
addStarts(Iterator<Traverser.Admin<S>> starts)
Add an iterator ofTraverser.Admin
objects of type S to the step.void
clearLabels()
Removes all labels on 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 necessaryTraverserRequirement
that must be met by the traverser in order for the step to function properly.<A,B>
Traversal.Admin<A,B>getTraversal()
Get theTraversal.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 theTraversal
that this step is contained within.-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
-
-
-
Method Detail
-
addStarts
void addStarts(Iterator<Traverser.Admin<S>> starts)
Add an iterator ofTraverser.Admin
objects of type S to the step.- Parameters:
starts
- The iterator of objects to add
-
addStart
void addStart(Traverser.Admin<S> start)
Add a singleTraverser.Admin
to the step.- Parameters:
start
- The traverser to add
-
hasStarts
boolean hasStarts()
Determines if starts objects are present without iterating forward. This function has special applicability aroundReducingBarrierStep
implementations where they always returntrue
for calls toIterator.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.
-
setPreviousStep
void setPreviousStep(Step<?,S> step)
Set the step that is previous to the current step. Used for linking steps together to form a function chain.- Parameters:
step
- the previous step of this step
-
getPreviousStep
Step<?,S> getPreviousStep()
Get the step prior to the current step.- Returns:
- The previous step
-
setNextStep
void setNextStep(Step<E,?> step)
Set the step that is next to the current step. Used for linking steps together to form a function chain.- Parameters:
step
- the next step of this step
-
getTraversal
<A,B> Traversal.Admin<A,B> getTraversal()
Get theTraversal.Admin
that this step is contained within.- Type Parameters:
A
- The incoming object type of the traversalB
- The outgoing object type of the traversal- Returns:
- The traversal of this step
-
setTraversal
void setTraversal(Traversal.Admin<?,?> traversal)
Set theTraversal
that this step is contained within.- Parameters:
traversal
- the new traversal for this step
-
reset
void reset()
Reset the state of the step such that it has no incoming starts. Internal states are to be reset, but any sideEffect data structures are not to be recreated.
-
clone
Step<S,E> clone()
Cloning is used to duplicate steps for the purpose of traversal optimization and OLTP replication. When cloning a step, it is important that the steps, the cloned step is equivalent to the state of the step whenreset()
is called. Moreover, the previous and next steps should be set toEmptyStep
.- Returns:
- The cloned step
-
getLabels
Set<String> getLabels()
Get the labels of this step. The labels are ordered by the order of the calls toaddLabel(java.lang.String)
.- Returns:
- the set of labels for this step
-
addLabel
void addLabel(String label)
Add a label to this step.- Parameters:
label
- the label to add to this step
-
removeLabel
void removeLabel(String label)
Remove a label from this step.- Parameters:
label
- the label to remove from this step
-
clearLabels
void clearLabels()
Removes all labels on the step.
-
setId
void setId(String id)
Get the unique id of the step. These ids can change when strategies are applied and anonymous traversals are embedded in the parent traversal. A developer should typically not need to call this method.- Parameters:
id
- the unique id of the step
-
getId
String getId()
Get the unique id of this step.- Returns:
- the unique id of the step
-
getRequirements
default Set<TraverserRequirement> getRequirements()
Provide the necessaryTraverserRequirement
that must be met by the traverser in order for the step to function properly. The provided default implements returns an empty set.- Returns:
- the set of requirements
-
equals
default boolean equals(Step other, boolean compareIds)
Compare the current step with another step.- Parameters:
other
- the other stepcompareIds
- whether to compare step IDs or not- Returns:
- true if the steps are equal, otherwise false
-
-