public class DefaultTraversal<S,E> extends Object implements Traversal.Admin<S,E>
Traversal.Admin<S,E>, Traversal.Exceptions, Traversal.Symbols
Modifier and Type | Field and Description |
---|---|
protected Bytecode |
bytecode |
protected TraverserGenerator |
generator |
protected Graph |
graph |
protected boolean |
locked |
protected TraversalParent |
parent |
protected Set<TraverserRequirement> |
requirements |
protected TraversalSideEffects |
sideEffects |
protected List<Step> |
steps |
protected TraversalStrategies |
strategies |
protected List<Step> |
unmodifiableSteps |
Constructor and Description |
---|
DefaultTraversal() |
DefaultTraversal(Bytecode bytecode) |
DefaultTraversal(Graph graph) |
DefaultTraversal(TraversalSource traversalSource) |
DefaultTraversal(TraversalSource traversalSource,
Traversal.Admin<S,E> traversal) |
Modifier and Type | Method and Description |
---|---|
void |
addStart(Traverser.Admin<S> start)
Add a single
Traverser.Admin object to the head of the traversal. |
void |
addStarts(Iterator<Traverser.Admin<S>> starts)
Add an iterator of
Traverser.Admin objects to the head/start of the traversal. |
<S2,E2> Traversal.Admin<S2,E2> |
addStep(int index,
Step<?,?> step)
Add a
Step to an arbitrary point in the traversal. |
void |
applyStrategies()
Apply the registered
TraversalStrategies to the traversal. |
Traversal.Admin<S,E> |
asAdmin()
Get access to administrative methods of the traversal via its accompanying
Traversal.Admin . |
DefaultTraversal<S,E> |
clone()
Cloning is used to duplicate the traversal typically in OLAP environments.
|
boolean |
equals(Object other) |
Bytecode |
getBytecode()
Get the
Bytecode associated with the construction of this traversal. |
Step<?,E> |
getEndStep()
Get the end/tail of the traversal.
|
Optional<Graph> |
getGraph() |
TraversalParent |
getParent()
Get the
TraversalParent Step that is the parent of this traversal. |
TraversalSideEffects |
getSideEffects()
Get the
TraversalSideEffects associated with the traversal. |
Step<S,?> |
getStartStep()
Get the start/head of the traversal.
|
List<Step> |
getSteps()
Get the
Step instances associated with this traversal. |
TraversalStrategies |
getStrategies()
Get the
TraversalStrategies associated with this traversal. |
TraverserGenerator |
getTraverserGenerator()
Get the
TraverserGenerator associated with this traversal. |
Set<TraverserRequirement> |
getTraverserRequirements()
Get the set of all
TraverserRequirement s for this traversal. |
int |
hashCode() |
boolean |
hasNext() |
boolean |
isLocked()
When the traversal has had its
TraversalStrategies applied to it, it is locked. |
E |
next() |
Traverser.Admin<E> |
nextTraverser() |
<S2,E2> Traversal.Admin<S2,E2> |
removeStep(int index)
Remove a
Step from the traversal. |
void |
reset()
Call the
Step.reset() method on every step in the traversal. |
void |
setGraph(Graph graph) |
void |
setParent(TraversalParent step)
Set the
TraversalParent Step that is the parent of this traversal. |
void |
setSideEffects(TraversalSideEffects sideEffects)
Set the
TraversalSideEffects of this traversal. |
void |
setStrategies(TraversalStrategies strategies)
Set the
TraversalStrategies to be used by this traversal at evaluation time. |
String |
toString() |
finalize, getClass, notify, notifyAll, wait, wait, wait
addStep, equals, removeStep
protected transient Graph graph
protected TraversalParent parent
protected TraversalSideEffects sideEffects
protected TraversalStrategies strategies
protected transient TraverserGenerator generator
protected Set<TraverserRequirement> requirements
protected boolean locked
protected Bytecode bytecode
public DefaultTraversal(Graph graph)
public DefaultTraversal(TraversalSource traversalSource)
public DefaultTraversal(TraversalSource traversalSource, Traversal.Admin<S,E> traversal)
public DefaultTraversal()
public DefaultTraversal(Bytecode bytecode)
public Bytecode getBytecode()
Traversal.Admin
Bytecode
associated with the construction of this traversal.getBytecode
in interface Traversal.Admin<S,E>
public Traversal.Admin<S,E> asAdmin()
Traversal
Traversal.Admin
.public TraverserGenerator getTraverserGenerator()
Traversal.Admin
TraverserGenerator
associated with this traversal.
The traversal generator creates Traverser
instances that are respective of the traversal's TraverserRequirement
.getTraverserGenerator
in interface Traversal.Admin<S,E>
public void applyStrategies() throws IllegalStateException
Traversal.Admin
TraversalStrategies
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 strategies to root traversal, then to nested traversals.applyStrategies
in interface Traversal.Admin<S,E>
IllegalStateException
- if the TraversalStrategies
have already been appliedpublic Set<TraverserRequirement> getTraverserRequirements()
Traversal.Admin
TraverserRequirement
s for this traversal.getTraverserRequirements
in interface Traversal.Admin<S,E>
public List<Step> getSteps()
Traversal.Admin
Step
instances associated with this traversal.
The steps are ordered according to their linked list structure as defined by Step.getPreviousStep()
and Step.getNextStep()
.getSteps
in interface Traversal.Admin<S,E>
public Traverser.Admin<E> nextTraverser()
nextTraverser
in interface Traversal.Admin<S,E>
public void reset()
Traversal.Admin
Step.reset()
method on every step in the traversal.reset
in interface Traversal.Admin<S,E>
public void addStart(Traverser.Admin<S> start)
Traversal.Admin
Traverser.Admin
object to the head of the traversal.
Users should typically not need to call this method. For dynamic inject of data, they should use InjectStep
.addStart
in interface Traversal.Admin<S,E>
start
- a traverser to add to the traversalpublic void addStarts(Iterator<Traverser.Admin<S>> starts)
Traversal.Admin
Traverser.Admin
objects to the head/start of the traversal.
Users should typically not need to call this method. For dynamic inject of data, they should use InjectStep
.addStarts
in interface Traversal.Admin<S,E>
starts
- an iterators of traverserspublic Step<S,?> getStartStep()
Traversal.Admin
EmptyStep
instance is returned.getStartStep
in interface Traversal.Admin<S,E>
public Step<?,E> getEndStep()
Traversal.Admin
EmptyStep
instance is returned.getEndStep
in interface Traversal.Admin<S,E>
public DefaultTraversal<S,E> clone()
Traversal.Admin
public boolean isLocked()
Traversal.Admin
TraversalStrategies
applied to it, it is locked.isLocked
in interface Traversal.Admin<S,E>
public void setSideEffects(TraversalSideEffects sideEffects)
Traversal.Admin
TraversalSideEffects
of this traversal.setSideEffects
in interface Traversal.Admin<S,E>
sideEffects
- the sideEffects to set for this traversal.public TraversalSideEffects getSideEffects()
Traversal.Admin
TraversalSideEffects
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 using GraphTraversal.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).getSideEffects
in interface Traversal.Admin<S,E>
public void setStrategies(TraversalStrategies strategies)
Traversal.Admin
TraversalStrategies
to be used by this traversal at evaluation time.setStrategies
in interface Traversal.Admin<S,E>
strategies
- the strategies to use on this traversalpublic TraversalStrategies getStrategies()
Traversal.Admin
TraversalStrategies
associated with this traversal.getStrategies
in interface Traversal.Admin<S,E>
public <S2,E2> Traversal.Admin<S2,E2> addStep(int index, Step<?,?> step) throws IllegalStateException
Traversal.Admin
Step
to an arbitrary point in the traversal.addStep
in interface Traversal.Admin<S,E>
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)index
- the location in the traversal to insert the stepstep
- the step to addIllegalStateException
- if the TraversalStrategies
have already been appliedpublic <S2,E2> Traversal.Admin<S2,E2> removeStep(int index) throws IllegalStateException
Traversal.Admin
Step
from the traversal.removeStep
in interface Traversal.Admin<S,E>
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)index
- the location in the traversal of the step to be evictedIllegalStateException
- if the TraversalStrategies
have already been appliedpublic void setParent(TraversalParent step)
Traversal.Admin
TraversalParent
Step
that is the parent of this traversal.
Traversals can be nested and this is the means by which the traversal tree is connected.setParent
in interface Traversal.Admin<S,E>
step
- the traversal holder parent steppublic TraversalParent getParent()
Traversal.Admin
TraversalParent
Step
that is the parent of this traversal.
Traversals can be nested and this is the means by which the traversal tree is walked.getParent
in interface Traversal.Admin<S,E>
public void setGraph(Graph graph)
setGraph
in interface Traversal.Admin<S,E>
Copyright © 2013–2019 Apache Software Foundation. All rights reserved.