public final class TraversalHelper extends Object
Modifier and Type | Method and Description |
---|---|
static <S> void |
addToCollection(Collection<S> collection,
S s,
long bulk) |
static <S> void |
addToCollectionUnrollIterator(Collection<S> collection,
S s,
long bulk) |
static boolean |
anyStepRecursively(Predicate<Step> predicate,
Traversal.Admin<?,?> traversal)
|
static <S> Optional<S> |
getFirstStepOfAssignableClass(Class<S> stepClass,
Traversal.Admin<?,?> traversal) |
static Set<String> |
getLabels(Traversal.Admin<?,?> traversal) |
static <S> Optional<S> |
getLastStepOfAssignableClass(Class<S> stepClass,
Traversal.Admin<?,?> traversal) |
static Traversal.Admin<?,?> |
getRootTraversal(Traversal.Admin<?,?> traversal) |
static String |
getShortName(Step step,
int maxLength)
Returns the name of step truncated to maxLength.
|
static <S> List<S> |
getStepsOfAssignableClass(Class<S> stepClass,
Traversal.Admin<?,?> traversal) |
static <S> List<S> |
getStepsOfAssignableClassRecursively(Class<S> stepClass,
Traversal.Admin<?,?> traversal) |
static <S> List<S> |
getStepsOfAssignableClassRecursively(Scope scope,
Class<S> stepClass,
Traversal.Admin<?,?> traversal) |
static <S> List<S> |
getStepsOfClass(Class<S> stepClass,
Traversal.Admin<?,?> traversal) |
static Set<Scoping.Variable> |
getVariableLocations(Traversal.Admin<?,?> traversal) |
static boolean |
hasStepOfAssignableClass(Class superClass,
Traversal.Admin<?,?> traversal)
Determine if the traversal has a step of an assignable class.
|
static boolean |
hasStepOfAssignableClassRecursively(Class stepClass,
Traversal.Admin<?,?> traversal)
Determine if the traversal has a step of an assignable class in the current
Traversal and its
local and global child traversals. |
static boolean |
hasStepOfAssignableClassRecursively(Collection<Class> stepClasses,
Traversal.Admin<?,?> traversal)
Determine if the traversal has any of the supplied steps of an assignable class in the current
Traversal
and its global or local child traversals. |
static boolean |
hasStepOfAssignableClassRecursively(Scope scope,
Class stepClass,
Traversal.Admin<?,?> traversal)
|
static boolean |
hasStepOfAssignableClassRecursively(Scope scope,
Collection<Class> stepClasses,
Traversal.Admin<?,?> traversal)
|
static boolean |
hasStepOfClass(Class stepClass,
Traversal.Admin<?,?> traversal)
Determine if the traversal has a step of a particular class.
|
static <S,E> void |
insertAfterStep(Step<S,E> insertStep,
Step<?,S> beforeStep,
Traversal.Admin<?,?> traversal)
Insert a step after a specified step instance.
|
static <S,E> void |
insertBeforeStep(Step<S,E> insertStep,
Step<E,?> afterStep,
Traversal.Admin<?,?> traversal)
Insert a step before a specified step instance.
|
static <S,E> Step<?,E> |
insertTraversal(int insertIndex,
Traversal.Admin<S,E> insertTraversal,
Traversal.Admin<?,?> traversal) |
static <S,E> Step<?,E> |
insertTraversal(Step<?,S> previousStep,
Traversal.Admin<S,E> insertTraversal,
Traversal.Admin<?,?> traversal) |
static boolean |
isGlobalChild(Traversal.Admin<?,?> traversal) |
static boolean |
isLocalProperties(Traversal.Admin<?,?> traversal) |
static boolean |
isLocalStarGraph(Traversal.Admin<?,?> traversal) |
static boolean |
onGraphComputer(Traversal.Admin<?,?> traversal) |
static void |
reIdSteps(StepPosition stepPosition,
Traversal.Admin<?,?> traversal) |
static <S,E> void |
removeToTraversal(Step<S,?> startStep,
Step<?,E> endStep,
Traversal.Admin<S,E> newTraversal) |
static <S,E> void |
replaceStep(Step<S,E> removeStep,
Step<S,E> insertStep,
Traversal.Admin<?,?> traversal)
Replace a step with a new step.
|
static <S,E> int |
stepIndex(Step<S,E> step,
Traversal.Admin<?,?> traversal)
Gets the index of a particular step in the
Traversal . |
public static boolean isLocalProperties(Traversal.Admin<?,?> traversal)
public static boolean isLocalStarGraph(Traversal.Admin<?,?> traversal)
public static <S,E> void insertBeforeStep(Step<S,E> insertStep, Step<E,?> afterStep, Traversal.Admin<?,?> traversal)
insertStep
- the step to insertafterStep
- the step to insert the new step beforetraversal
- the traversal on which the action should occurpublic static <S,E> void insertAfterStep(Step<S,E> insertStep, Step<?,S> beforeStep, Traversal.Admin<?,?> traversal)
insertStep
- the step to insertbeforeStep
- the step to insert the new step aftertraversal
- the traversal on which the action should occurpublic static <S,E> void replaceStep(Step<S,E> removeStep, Step<S,E> insertStep, Traversal.Admin<?,?> traversal)
removeStep
- the step to removeinsertStep
- the step to inserttraversal
- the traversal on which the action will occurpublic static <S,E> Step<?,E> insertTraversal(Step<?,S> previousStep, Traversal.Admin<S,E> insertTraversal, Traversal.Admin<?,?> traversal)
public static <S,E> Step<?,E> insertTraversal(int insertIndex, Traversal.Admin<S,E> insertTraversal, Traversal.Admin<?,?> traversal)
public static <S,E> void removeToTraversal(Step<S,?> startStep, Step<?,E> endStep, Traversal.Admin<S,E> newTraversal)
public static <S,E> int stepIndex(Step<S,E> step, Traversal.Admin<?,?> traversal)
Traversal
.step
- the step to retrieve the index fortraversal
- the traversal to perform the action onpublic static <S> List<S> getStepsOfClass(Class<S> stepClass, Traversal.Admin<?,?> traversal)
public static <S> List<S> getStepsOfAssignableClass(Class<S> stepClass, Traversal.Admin<?,?> traversal)
public static <S> Optional<S> getLastStepOfAssignableClass(Class<S> stepClass, Traversal.Admin<?,?> traversal)
public static <S> Optional<S> getFirstStepOfAssignableClass(Class<S> stepClass, Traversal.Admin<?,?> traversal)
public static <S> List<S> getStepsOfAssignableClassRecursively(Class<S> stepClass, Traversal.Admin<?,?> traversal)
public static <S> List<S> getStepsOfAssignableClassRecursively(Scope scope, Class<S> stepClass, Traversal.Admin<?,?> traversal)
public static boolean isGlobalChild(Traversal.Admin<?,?> traversal)
public static boolean hasStepOfClass(Class stepClass, Traversal.Admin<?,?> traversal)
stepClass
- the step class to look fortraversal
- the traversal to perform the action ontrue
if the class is found and false
otherwisepublic static boolean hasStepOfAssignableClass(Class superClass, Traversal.Admin<?,?> traversal)
superClass
- the step super class to look fortraversal
- the traversal to perform the action ontrue
if the class is found and false
otherwisepublic static boolean hasStepOfAssignableClassRecursively(Class stepClass, Traversal.Admin<?,?> traversal)
Traversal
and its
local and global child traversals.stepClass
- the step class to look fortraversal
- the traversal in which to look for the given step classtrue
if any step in the given traversal (and its child traversals) is an instance of the
given stepClass
, otherwise false
.public static boolean hasStepOfAssignableClassRecursively(Scope scope, Class stepClass, Traversal.Admin<?,?> traversal)
Traversal
and its
Scope
child traversals.scope
- the child traversal scope to checkstepClass
- the step class to look fortraversal
- the traversal in which to look for the given step classtrue
if any step in the given traversal (and its child traversals) is an instance of the
given stepClass
, otherwise false
.public static boolean hasStepOfAssignableClassRecursively(Collection<Class> stepClasses, Traversal.Admin<?,?> traversal)
Traversal
and its global or local child traversals.stepClasses
- the step classes to look fortraversal
- the traversal in which to look for the given step classestrue
if any step in the given traversal (and its child traversals) is an instance of a class
provided in stepClasses
, otherwise false
.public static boolean hasStepOfAssignableClassRecursively(Scope scope, Collection<Class> stepClasses, Traversal.Admin<?,?> traversal)
Traversal
and its Scope
child traversals.scope
- whether to check global or local children (null for both).stepClasses
- the step classes to look fortraversal
- the traversal in which to look for the given step classestrue
if any step in the given traversal (and its child traversals) is an instance of a class
provided in stepClasses
, otherwise false
.public static boolean anyStepRecursively(Predicate<Step> predicate, Traversal.Admin<?,?> traversal)
predicate
- the match functiontraversal
- th traversal to perform the action ontrue
if there is a match and false
otherwisepublic static <S> void addToCollection(Collection<S> collection, S s, long bulk)
public static <S> void addToCollectionUnrollIterator(Collection<S> collection, S s, long bulk)
public static String getShortName(Step step, int maxLength)
step
- maxLength
- Includes the 3 "..." characters that will be appended when the length of the name exceeds
maxLength.public static void reIdSteps(StepPosition stepPosition, Traversal.Admin<?,?> traversal)
public static Traversal.Admin<?,?> getRootTraversal(Traversal.Admin<?,?> traversal)
public static Set<String> getLabels(Traversal.Admin<?,?> traversal)
public static Set<Scoping.Variable> getVariableLocations(Traversal.Admin<?,?> traversal)
public static boolean onGraphComputer(Traversal.Admin<?,?> traversal)
Copyright © 2013–2016 Apache Software Foundation. All rights reserved.