Package com.tinkerpop.gremlin.process.graph.step.branch

Examples of com.tinkerpop.gremlin.process.graph.step.branch.JumpStep


            leftEndStep.setLabel(UNTIL_PREFIX + counter++);
            TraversalHelper.insertBeforeStep(leftEndStep, untilStep, traversal);
            final Step rightEndStep = TraversalHelper.getStep(untilStep.getBreakLabel(), traversal);
            final String rightEndLabel = rightEndStep.getLabel();

            final JumpStep leftEndJumpStep = untilStep.createLeftJumpStep(traversal, rightEndLabel);
            leftEndJumpStep.setLabel(untilStep.getLabel());
            leftEndJumpStep.doWhile = false;
            TraversalHelper.removeStep(untilStep, traversal);
            TraversalHelper.insertAfterStep(leftEndJumpStep, leftEndStep, traversal);

            final JumpStep rightEndJumpStep = untilStep.createRightJumpStep(traversal, leftEndStep.getLabel());
            //new JumpStep(traversal, leftEndStep.getLabel());
            rightEndJumpStep.setLabel(rightEndLabel);
            rightEndStep.setLabel(Graph.System.system(UUID.randomUUID().toString()));
            TraversalHelper.insertAfterStep(rightEndJumpStep, rightEndStep, traversal);
        }
    }
View Full Code Here


                        if (TraversalHelper.isLabeled(toStep))
                            toStep.getPreviousStep().setLabel(toStep.getLabel());
                        TraversalHelper.removeStep(toStep, traversal);
                    } else {
                        // WHILE DO SEMANTICS
                        final JumpStep fromStep = (JumpStep) TraversalHelper.getStep(toStep.getJumpLabel(), traversal);
                        final List<Step> stepsToClone = TraversalHelper.isolateSteps(toStep, fromStep);
                        stepsToClone.forEach(stepToClone -> TraversalHelper.removeStep(stepToClone, traversal));
                        for (int i = 0; i < ((short) toStep.getJumpLoops().getValue0() + 1); i++) {
                            for (int j = stepsToClone.size() - 1; j >= 0; j--) {
                                try {
                                    final Step clonedStep = stepsToClone.get(j).clone();
                                    TraversalHelper.insertStep(clonedStep, traversal.getSteps().indexOf(fromStep) + 1, traversal);
                                } catch (final CloneNotSupportedException e) {
                                    throw new IllegalStateException(e.getMessage(), e);
                                }
                            }
                        }
                        // System.out.println(toStep + "::" + fromStep + "::" + fromStep.jumpLabel);
                        TraversalHelper.removeStep(TraversalHelper.getStep(fromStep.getJumpLabel(), traversal), traversal); // identity marker
                        TraversalHelper.removeStep(toStep, traversal); // left hand jump
                        TraversalHelper.removeStep(fromStep, traversal); // right hand jump
                        if (TraversalHelper.isLabeled(toStep))
                            toStep.getPreviousStep().setLabel(toStep.getLabel());
                        TraversalHelper.removeStep(toStep, traversal);
View Full Code Here

TOP

Related Classes of com.tinkerpop.gremlin.process.graph.step.branch.JumpStep

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.