Java Code Examples for org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep#instance()
The following examples show how to use
org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep#instance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReferenceElementStrategy.java From tinkerpop with Apache License 2.0 | 5 votes |
@Override public void apply(final Traversal.Admin<?, ?> traversal) { if (traversal.getParent() == EmptyStep.instance()) { final Optional<ProfileSideEffectStep> profileStep = TraversalHelper.getFirstStepOfAssignableClass(ProfileSideEffectStep.class, traversal); final int index = profileStep.map(step -> traversal.getSteps().indexOf(step)) .orElseGet(() -> traversal.getSteps().size()); traversal.addStep(index, new ReferenceElementStep<>(traversal)); } }
Example 2
Source File: VertexProgramStrategy.java From tinkerpop with Apache License 2.0 | 5 votes |
private static Step<?, ?> getFirstLegalOLAPStep(Step<?, ?> currentStep) { while (!(currentStep instanceof EmptyStep)) { if (!(currentStep instanceof VertexComputing)) return currentStep; currentStep = currentStep.getNextStep(); } return EmptyStep.instance(); }
Example 3
Source File: VertexProgramStrategy.java From tinkerpop with Apache License 2.0 | 5 votes |
private static Step<?, ?> getLastLegalOLAPStep(Step<?, ?> currentStep) { while (currentStep instanceof VertexComputing) currentStep = currentStep.getNextStep(); while (!(currentStep instanceof EmptyStep)) { if (currentStep instanceof VertexComputing) return currentStep.getPreviousStep(); currentStep = currentStep.getNextStep(); } return EmptyStep.instance(); }
Example 4
Source File: AbstractLambdaTraversal.java From tinkerpop with Apache License 2.0 | 4 votes |
@Override public TraversalParent getParent() { return null == this.bypassTraversal ? EmptyStep.instance() : this.bypassTraversal.getParent(); }
Example 5
Source File: EmptyTraversal.java From tinkerpop with Apache License 2.0 | 4 votes |
@Override public TraversalParent getParent() { return EmptyStep.instance(); }
Example 6
Source File: DefaultTraversal.java From tinkerpop with Apache License 2.0 | 4 votes |
@Override public Step<S, ?> getStartStep() { return this.steps.isEmpty() ? EmptyStep.instance() : this.steps.get(0); }
Example 7
Source File: DefaultTraversal.java From tinkerpop with Apache License 2.0 | 4 votes |
@Override public Step<?, E> getEndStep() { return this.steps.isEmpty() ? EmptyStep.instance() : this.steps.get(this.steps.size() - 1); }
Example 8
Source File: DefaultTraversal.java From tinkerpop with Apache License 2.0 | 4 votes |
@Override public void setParent(final TraversalParent step) { this.parent = null == step ? EmptyStep.instance() : step; }
Example 9
Source File: Traversal.java From tinkerpop with Apache License 2.0 | 2 votes |
/** * Get the start/head of the traversal. If the traversal is empty, then an {@link EmptyStep} instance is returned. * * @return the start step of the traversal */ public default Step<S, ?> getStartStep() { final List<Step> steps = this.getSteps(); return steps.isEmpty() ? EmptyStep.instance() : steps.get(0); }
Example 10
Source File: Traversal.java From tinkerpop with Apache License 2.0 | 2 votes |
/** * Get the end/tail of the traversal. If the traversal is empty, then an {@link EmptyStep} instance is returned. * * @return the end step of the traversal */ public default Step<?, E> getEndStep() { final List<Step> steps = this.getSteps(); return steps.isEmpty() ? EmptyStep.instance() : steps.get(steps.size() - 1); }