Class EmptyStep<S,E>
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep<S,E>
-
- All Implemented Interfaces:
Serializable
,AutoCloseable
,Cloneable
,Iterator<Traverser.Admin<E>>
,Step<S,E>
,TraversalParent
public final class EmptyStep<S,E> extends Object implements Step<S,E>, TraversalParent
- Author:
- Marko A. Rodriguez (http://markorodriguez.com)
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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.EmptyStep<S,E>
clone()
Cloning is used to duplicate steps for the purpose of traversal optimization and OLTP replication.boolean
equals(Object object)
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.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.int
hashCode()
boolean
hasNext()
boolean
hasStarts()
Determines if starts objects are present without iterating forward.static <S,E>
EmptyStep<S,E>instance()
Traverser.Admin<E>
next()
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 class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent
addGlobalChild, addLocalChild, asStep, close, getGlobalChildren, getLocalChildren, getSelfAndChildRequirements, integrateChild, removeGlobalChild, removeLocalChild, replaceLocalChild
-
-
-
-
Method Detail
-
instance
public static <S,E> EmptyStep<S,E> instance()
-
addStarts
public void addStarts(Iterator<Traverser.Admin<S>> starts)
Description copied from interface:Step
Add an iterator ofTraverser.Admin
objects of type S to the step.
-
hasStarts
public boolean hasStarts()
Description copied from interface:Step
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.
-
addStart
public void addStart(Traverser.Admin<S> start)
Description copied from interface:Step
Add a singleTraverser.Admin
to the step.
-
setPreviousStep
public void setPreviousStep(Step<?,S> step)
Description copied from interface:Step
Set the step that is previous to the current step. Used for linking steps together to form a function chain.- Specified by:
setPreviousStep
in interfaceStep<S,E>
- Parameters:
step
- the previous step of this step
-
reset
public void reset()
Description copied from interface:Step
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.
-
getPreviousStep
public Step<?,S> getPreviousStep()
Description copied from interface:Step
Get the step prior to the current step.- Specified by:
getPreviousStep
in interfaceStep<S,E>
- Returns:
- The previous step
-
setNextStep
public void setNextStep(Step<E,?> step)
Description copied from interface:Step
Set the step that is next to the current step. Used for linking steps together to form a function chain.- Specified by:
setNextStep
in interfaceStep<S,E>
- Parameters:
step
- the next step of this step
-
getNextStep
public Step<E,?> getNextStep()
Description copied from interface:Step
Get the next step to the current step.- Specified by:
getNextStep
in interfaceStep<S,E>
- Returns:
- The next step
-
getTraversal
public <A,B> Traversal.Admin<A,B> getTraversal()
Description copied from interface:Step
Get theTraversal.Admin
that this step is contained within.- Specified by:
getTraversal
in interfaceStep<S,E>
- Type Parameters:
A
- The incoming object type of the traversalB
- The outgoing object type of the traversal- Returns:
- The traversal of this step
-
setTraversal
public void setTraversal(Traversal.Admin<?,?> traversal)
Description copied from interface:Step
Set theTraversal
that this step is contained within.- Specified by:
setTraversal
in interfaceStep<S,E>
- Parameters:
traversal
- the new traversal for this step
-
clone
public EmptyStep<S,E> clone()
Description copied from interface:Step
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 whenStep.reset()
is called. Moreover, the previous and next steps should be set toEmptyStep
.
-
getLabels
public Set<String> getLabels()
Description copied from interface:Step
Get the labels of this step. The labels are ordered by the order of the calls toStep.addLabel(java.lang.String)
.
-
addLabel
public void addLabel(String label)
Description copied from interface:Step
Add a label to this step.
-
removeLabel
public void removeLabel(String label)
Description copied from interface:Step
Remove a label from this step.- Specified by:
removeLabel
in interfaceStep<S,E>
- Parameters:
label
- the label to remove from this step
-
clearLabels
public void clearLabels()
Description copied from interface:Step
Removes all labels on the step.- Specified by:
clearLabels
in interfaceStep<S,E>
-
setId
public void setId(String id)
Description copied from interface:Step
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.
-
next
public Traverser.Admin<E> next()
-
getRequirements
public Set<TraverserRequirement> getRequirements()
Description copied from interface:Step
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.- Specified by:
getRequirements
in interfaceStep<S,E>
- Returns:
- the set of requirements
-
-