Class AbstractRemoteTraversal<S,E>
java.lang.Object
org.apache.tinkerpop.gremlin.process.remote.traversal.AbstractRemoteTraversal<S,E>
- All Implemented Interfaces:
Serializable,AutoCloseable,Cloneable,Iterator<E>,RemoteTraversal<S,,E> Traversal<S,,E> Traversal.Admin<S,E>
- Direct Known Subclasses:
DriverRemoteTraversal,EmbeddedRemoteTraversal
This is a stub implementation for
RemoteTraversal and requires that the nextTraverser() method
is implemented from Traversal.Admin. It is this method that gets called from RemoteStep when
the Traversal is iterated.- Author:
- Stephen Mallette (http://stephen.genoprime.com)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traversal
Traversal.Admin<S,E>, Traversal.Exceptions, Traversal.Symbols -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<S2,E2> Traversal.Admin<S2, E2> Add aStepto an arbitrary point in the traversal.voidApply the registeredTraversalStrategiesto the traversal.clone()Cloning is used to duplicate the traversal typically in OLAP environments.getGraph()Get theGremlinLangassociated with the construction of this traversal.Get theGValueManagerassociated with this traversal.Get theTraversalParentStepthat is the parent of this traversal.Get theTraversalSideEffectsassociated with the traversal.getSteps()Get theStepinstances associated with this traversal.Get theTraversalStrategiesassociated with this traversal.Get theTraverserGeneratorassociated with this traversal.Get the set of allTraverserRequirements for this traversal.booleanisLocked()When the traversal has had itsTraversalStrategiesapplied to it, it is locked.voidlock()Lock the traversal and perform any final adjustments to it after strategy application.abstract Traverser.Admin<E>Note that internally#nextTraverser()is called from within a loop (specifically inAbstractStep.next()that breaks properly when aNoSuchElementExceptionis thrown.<S2,E2> Traversal.Admin<S2, E2> removeStep(int index) Remove aStepfrom the traversal.voidvoidsetGValueManager(GValueManager gValueManager) Set theGValueManagerassociated with this traversal.voidsetParent(TraversalParent step) Set theTraversalParentStepthat is the parent of this traversal.voidsetSideEffects(TraversalSideEffects sideEffects) Set theTraversalSideEffectsof this traversal.voidsetStrategies(TraversalStrategies strategies) Set theTraversalStrategiesto be used by this traversal at evaluation time.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traversal
asAdmin, close, discard, explain, fill, forEachRemaining, forEachRemaining, iterate, next, notifyClose, profile, promise, toBulkSet, toList, toSet, toStream, tryNextMethods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.Traversal.Admin
addStart, addStarts, addStep, equals, getEndStep, getStartStep, getTraversalSource, getTraverserSetSupplier, isRoot, removeStep, reset
-
Constructor Details
-
AbstractRemoteTraversal
public AbstractRemoteTraversal()
-
-
Method Details
-
nextTraverser
Note that internally#nextTraverser()is called from within a loop (specifically inAbstractStep.next()that breaks properly when aNoSuchElementExceptionis thrown. In other words the "results" should be iterated to force that failure.- Specified by:
nextTraverserin interfaceTraversal.Admin<S,E>
-
getSideEffects
Description copied from interface:Traversal.AdminGet theTraversalSideEffectsassociated 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:
getSideEffectsin interfaceTraversal.Admin<S,E> - Returns:
- The traversal sideEffects
-
getGremlinLang
Description copied from interface:Traversal.AdminGet theGremlinLangassociated with the construction of this traversal.- Specified by:
getGremlinLangin interfaceTraversal.Admin<S,E> - Returns:
- the byte code representation of the traversal
-
getGValueManager
Description copied from interface:Traversal.AdminGet theGValueManagerassociated with this traversal.- Specified by:
getGValueManagerin interfaceTraversal.Admin<S,E>
-
setGValueManager
Description copied from interface:Traversal.AdminSet theGValueManagerassociated with this traversal.- Specified by:
setGValueManagerin interfaceTraversal.Admin<S,E>
-
getSteps
Description copied from interface:Traversal.AdminGet theStepinstances associated with this traversal. The steps are ordered according to their linked list structure as defined byStep.getPreviousStep()andStep.getNextStep().- Specified by:
getStepsin interfaceTraversal.Admin<S,E> - Returns:
- the ordered steps of the traversal
-
addStep
public <S2,E2> Traversal.Admin<S2,E2> addStep(int index, Step<?, ?> step) throws IllegalStateExceptionDescription copied from interface:Traversal.AdminAdd aStepto an arbitrary point in the traversal.- Specified by:
addStepin 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 theTraversalStrategieshave already been applied
-
removeStep
Description copied from interface:Traversal.AdminRemove aStepfrom the traversal. Those implementing this method should take care to reset state for the step in theGValueManager.- Specified by:
removeStepin 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 theTraversalStrategieshave already been applied
-
applyStrategies
Description copied from interface:Traversal.AdminApply the registeredTraversalStrategiesto 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:
applyStrategiesin interfaceTraversal.Admin<S,E> - Throws:
IllegalStateException- if theTraversalStrategieshave already been applied
-
getTraverserGenerator
Description copied from interface:Traversal.AdminGet theTraverserGeneratorassociated with this traversal. The traversal generator createsTraverserinstances that are respective of the traversal'sTraverserRequirement.- Specified by:
getTraverserGeneratorin interfaceTraversal.Admin<S,E> - Returns:
- the generator of traversers
-
getTraverserRequirements
Description copied from interface:Traversal.AdminGet the set of allTraverserRequirements for this traversal.- Specified by:
getTraverserRequirementsin interfaceTraversal.Admin<S,E> - Returns:
- the features of a traverser that are required to execute properly in this traversal
-
setSideEffects
Description copied from interface:Traversal.AdminSet theTraversalSideEffectsof this traversal.- Specified by:
setSideEffectsin interfaceTraversal.Admin<S,E> - Parameters:
sideEffects- the sideEffects to set for this traversal.
-
setStrategies
Description copied from interface:Traversal.AdminSet theTraversalStrategiesto be used by this traversal at evaluation time.- Specified by:
setStrategiesin interfaceTraversal.Admin<S,E> - Parameters:
strategies- the strategies to use on this traversal
-
getStrategies
Description copied from interface:Traversal.AdminGet theTraversalStrategiesassociated with this traversal.- Specified by:
getStrategiesin interfaceTraversal.Admin<S,E> - Returns:
- the strategies associated with this traversal
-
setParent
Description copied from interface:Traversal.AdminSet theTraversalParentStepthat 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:
setParentin interfaceTraversal.Admin<S,E> - Parameters:
step- the traversal holder parent step orEmptyStepif it has no parent
-
getParent
Description copied from interface:Traversal.AdminGet theTraversalParentStepthat is the parent of this traversal. Traversals can be nested and this is the means by which the traversal tree is walked.- Specified by:
getParentin interfaceTraversal.Admin<S,E> - Returns:
- the traversal holder parent step or
EmptyStepif it has no parent.
-
clone
Description copied from interface:Traversal.AdminCloning is used to duplicate the traversal typically in OLAP environments. -
isLocked
public boolean isLocked()Description copied from interface:Traversal.AdminWhen the traversal has had itsTraversalStrategiesapplied to it, it is locked.- Specified by:
isLockedin interfaceTraversal.Admin<S,E> - Returns:
- whether the traversal is locked
-
lock
public void lock()Description copied from interface:Traversal.AdminLock the traversal and perform any final adjustments to it after strategy application.- Specified by:
lockin interfaceTraversal.Admin<S,E>
-
getGraph
Description copied from interface:Traversal.Admin- Specified by:
getGraphin interfaceTraversal.Admin<S,E>
-
setGraph
- Specified by:
setGraphin interfaceTraversal.Admin<S,E>
-