Class AbstractLambdaTraversal<S,E>
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.process.traversal.lambda.AbstractLambdaTraversal<S,E>
-
- All Implemented Interfaces:
Serializable
,AutoCloseable
,Cloneable
,Iterator<E>
,Traversal<S,E>
,Traversal.Admin<S,E>
- Direct Known Subclasses:
CardinalityValueTraversal
,ColumnTraversal
,ConstantTraversal
,HaltedTraversersCountTraversal
,IdentityTraversal
,LoopTraversal
,PredicateTraversal
,TokenTraversal
,TrueTraversal
,ValueTraversal
public abstract class AbstractLambdaTraversal<S,E> extends Object implements Traversal.Admin<S,E>
- Author:
- Marko A. Rodriguez (http://markorodriguez.com)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traversal
Traversal.Admin<S,E>, Traversal.Exceptions, Traversal.Symbols
-
-
Field Summary
Fields Modifier and Type Field Description protected Traversal.Admin<S,E>
bypassTraversal
-
Constructor Summary
Constructors Constructor Description AbstractLambdaTraversal()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addStart(Traverser.Admin<S> start)
Add a singleTraverser.Admin
object to the head of the traversal.<S2,E2>
Traversal.Admin<S2,E2>addStep(int index, Step<?,?> step)
Add aStep
to an arbitrary point in the traversal.void
applyStrategies()
Apply the registeredTraversalStrategies
to the traversal.Traversal.Admin<S,E>
clone()
Cloning is used to duplicate the traversal typically in OLAP environments.boolean
equals(Object object)
Traversal.Admin<S,E>
getBypassTraversal()
Bytecode
getBytecode()
Get theBytecode
associated with the construction of this traversal.Optional<Graph>
getGraph()
TraversalParent
getParent()
Get theTraversalParent
Step
that is the parent of this traversal.TraversalSideEffects
getSideEffects()
Get theTraversalSideEffects
associated with the traversal.List<Step>
getSteps()
Get theStep
instances associated with this traversal.TraversalStrategies
getStrategies()
Get theTraversalStrategies
associated with this traversal.TraverserGenerator
getTraverserGenerator()
Get theTraverserGenerator
associated with this traversal.Set<TraverserRequirement>
getTraverserRequirements()
Get the set of allTraverserRequirement
s for this traversal.int
hashCode()
boolean
hasNext()
boolean
isLocked()
When the traversal has had itsTraversalStrategies
applied to it, it is locked.boolean
isRoot()
Implementations of this class can never be a root-level traversal as they are specialized implementations intended to be child traversals by design.void
lock()
Lock the traversal and perform any final adjustments to it after strategy application.E
next()
Traverser.Admin<E>
nextTraverser()
<S2,E2>
Traversal.Admin<S2,E2>removeStep(int index)
Remove aStep
from the traversal.void
reset()
Call theStep.reset()
method on every step in the traversal.void
setBypassTraversal(Traversal.Admin<S,E> bypassTraversal)
void
setGraph(Graph graph)
void
setParent(TraversalParent step)
Set theTraversalParent
Step
that is the parent of this traversal.void
setSideEffects(TraversalSideEffects sideEffects)
Set theTraversalSideEffects
of this traversal.void
setStrategies(TraversalStrategies strategies)
Set theTraversalStrategies
to be used by this traversal at evaluation time.-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traversal
asAdmin, close, explain, fill, forEachRemaining, forEachRemaining, iterate, next, none, notifyClose, profile, promise, toBulkSet, toList, toSet, toStream, tryNext
-
Methods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traversal.Admin
addStarts, addStep, equals, getEndStep, getStartStep, getTraversalSource, getTraverserSetSupplier, removeStep
-
-
-
-
Field Detail
-
bypassTraversal
protected Traversal.Admin<S,E> bypassTraversal
-
-
Method Detail
-
setBypassTraversal
public void setBypassTraversal(Traversal.Admin<S,E> bypassTraversal)
-
getBypassTraversal
public Traversal.Admin<S,E> getBypassTraversal()
-
getSteps
public List<Step> getSteps()
Description copied from interface:Traversal.Admin
Get theStep
instances associated with this traversal. The steps are ordered according to their linked list structure as defined byStep.getPreviousStep()
andStep.getNextStep()
.- Specified by:
getSteps
in interfaceTraversal.Admin<S,E>
- Returns:
- the ordered steps of the traversal
-
getBytecode
public Bytecode getBytecode()
Description copied from interface:Traversal.Admin
Get theBytecode
associated with the construction of this traversal.- Specified by:
getBytecode
in interfaceTraversal.Admin<S,E>
- Returns:
- the byte code representation of the traversal
-
reset
public void reset()
Description copied from interface:Traversal.Admin
Call theStep.reset()
method on every step in the traversal.- Specified by:
reset
in interfaceTraversal.Admin<S,E>
-
addStep
public <S2,E2> Traversal.Admin<S2,E2> addStep(int index, Step<?,?> step) throws IllegalStateException
Description copied from interface:Traversal.Admin
Add aStep
to an arbitrary point in the traversal.- Specified by:
addStep
in interfaceTraversal.Admin<S,E>
- Type Parameters:
S2
- the new start type of the traversal (if the added step was a start step)E2
- the new end type of the traversal (if the added step was an end step)- Parameters:
index
- the location in the traversal to insert the stepstep
- the step to add- Returns:
- the newly modulated traversal
- Throws:
IllegalStateException
- if theTraversalStrategies
have already been applied
-
removeStep
public <S2,E2> Traversal.Admin<S2,E2> removeStep(int index) throws IllegalStateException
Description copied from interface:Traversal.Admin
Remove aStep
from the traversal.- Specified by:
removeStep
in interfaceTraversal.Admin<S,E>
- Type Parameters:
S2
- the new start type of the traversal (if the removed step was a start step)E2
- the new end type of the traversal (if the removed step was an end step)- Parameters:
index
- the location in the traversal of the step to be evicted- Returns:
- the newly modulated traversal
- Throws:
IllegalStateException
- if theTraversalStrategies
have already been applied
-
applyStrategies
public void applyStrategies() throws IllegalStateException
Description copied from interface:Traversal.Admin
Apply the registeredTraversalStrategies
to the traversal. Once the strategies are applied, the traversal is "locked" and can no longer have steps added to it. The order of operations for strategy applications should be: globally id steps, apply each strategy in turn to root traversal, then recursively to nested traversals.- Specified by:
applyStrategies
in interfaceTraversal.Admin<S,E>
- Throws:
IllegalStateException
- if theTraversalStrategies
have already been applied
-
getTraverserGenerator
public TraverserGenerator getTraverserGenerator()
Description copied from interface:Traversal.Admin
Get theTraverserGenerator
associated with this traversal. The traversal generator createsTraverser
instances that are respective of the traversal'sTraverserRequirement
.- Specified by:
getTraverserGenerator
in interfaceTraversal.Admin<S,E>
- Returns:
- the generator of traversers
-
setSideEffects
public void setSideEffects(TraversalSideEffects sideEffects)
Description copied from interface:Traversal.Admin
Set theTraversalSideEffects
of this traversal.- Specified by:
setSideEffects
in interfaceTraversal.Admin<S,E>
- Parameters:
sideEffects
- the sideEffects to set for this traversal.
-
getSideEffects
public TraversalSideEffects getSideEffects()
Description copied from interface:Traversal.Admin
Get theTraversalSideEffects
associated with the traversal. This method should not be called externally for purposes of retrieving side-effects as traversal results. Traversal results should only be returned by way of the execution of the traversal itself. Should a side-effect of a traversal be needed it should only be obtained by usingGraphTraversal.cap(String, String...)
so that the side-effect can be included as part of the traversal iteration. Relying on this method to get side-effects in these situations may not result in consistent behavior across all types of executions and environments (e.g. remoting).- Specified by:
getSideEffects
in interfaceTraversal.Admin<S,E>
- Returns:
- The traversal sideEffects
-
setStrategies
public void setStrategies(TraversalStrategies strategies)
Description copied from interface:Traversal.Admin
Set theTraversalStrategies
to be used by this traversal at evaluation time.- Specified by:
setStrategies
in interfaceTraversal.Admin<S,E>
- Parameters:
strategies
- the strategies to use on this traversal
-
getStrategies
public TraversalStrategies getStrategies()
Description copied from interface:Traversal.Admin
Get theTraversalStrategies
associated with this traversal.- Specified by:
getStrategies
in interfaceTraversal.Admin<S,E>
- Returns:
- the strategies associated with this traversal
-
setParent
public void setParent(TraversalParent step)
Description copied from interface:Traversal.Admin
Set theTraversalParent
Step
that is the parent of this traversal. Traversals can be nested and this is the means by which the traversal tree is connected. If there is no parent, then it should be aEmptyStep
.- Specified by:
setParent
in interfaceTraversal.Admin<S,E>
- Parameters:
step
- the traversal holder parent step orEmptyStep
if it has no parent
-
getParent
public TraversalParent getParent()
Description copied from interface:Traversal.Admin
Get theTraversalParent
Step
that is the parent of this traversal. Traversals can be nested and this is the means by which the traversal tree is walked.- Specified by:
getParent
in interfaceTraversal.Admin<S,E>
- Returns:
- the traversal holder parent step or
EmptyStep
if it has no parent.
-
clone
public Traversal.Admin<S,E> clone()
Description copied from interface:Traversal.Admin
Cloning is used to duplicate the traversal typically in OLAP environments.
-
nextTraverser
public Traverser.Admin<E> nextTraverser()
- Specified by:
nextTraverser
in interfaceTraversal.Admin<S,E>
-
addStart
public void addStart(Traverser.Admin<S> start)
Description copied from interface:Traversal.Admin
Add a singleTraverser.Admin
object to the head of the traversal. Users should typically not need to call this method. For dynamic inject of data, they should useInjectStep
.- Specified by:
addStart
in interfaceTraversal.Admin<S,E>
- Parameters:
start
- a traverser to add to the traversal
-
isLocked
public boolean isLocked()
Description copied from interface:Traversal.Admin
When the traversal has had itsTraversalStrategies
applied to it, it is locked.- Specified by:
isLocked
in interfaceTraversal.Admin<S,E>
- Returns:
- whether the traversal is locked
-
lock
public void lock()
Description copied from interface:Traversal.Admin
Lock the traversal and perform any final adjustments to it after strategy application.- Specified by:
lock
in interfaceTraversal.Admin<S,E>
-
isRoot
public boolean isRoot()
Implementations of this class can never be a root-level traversal as they are specialized implementations intended to be child traversals by design.- Specified by:
isRoot
in interfaceTraversal.Admin<S,E>
-
getGraph
public Optional<Graph> getGraph()
Description copied from interface:Traversal.Admin
- Specified by:
getGraph
in interfaceTraversal.Admin<S,E>
-
setGraph
public void setGraph(Graph graph)
- Specified by:
setGraph
in interfaceTraversal.Admin<S,E>
-
getTraverserRequirements
public Set<TraverserRequirement> getTraverserRequirements()
Description copied from interface:Traversal.Admin
Get the set of allTraverserRequirement
s for this traversal.- Specified by:
getTraverserRequirements
in interfaceTraversal.Admin<S,E>
- Returns:
- the features of a traverser that are required to execute properly in this traversal
-
-