@Override public <S2, E2> Traversal.Admin<S2, E2> addStep(final int index, final Step<?, ?> step) throws IllegalStateException { if (this.locked) throw Exceptions.traversalIsLocked(); step.setId(this.stepPosition.nextXId()); this.steps.add(index, step); final Step previousStep = this.steps.size() > 0 && index != 0 ? steps.get(index - 1) : null; final Step nextStep = this.steps.size() > index + 1 ? steps.get(index + 1) : null; step.setPreviousStep(null != previousStep ? previousStep : EmptyStep.instance()); step.setNextStep(null != nextStep ? nextStep : EmptyStep.instance()); if (null != previousStep) previousStep.setNextStep(step); if (null != nextStep) nextStep.setPreviousStep(step); step.setTraversal(this); return (Traversal.Admin<S2, E2>) this; }
if (null == stepPosition.parentId) stepPosition.parentId = ""; for (final Step<?, ?> step : traversal.getSteps()) { step.setId(stepPosition.nextXId());
@Override public <S2, E2> Traversal.Admin<S2, E2> addStep(final int index, final Step<?, ?> step) throws IllegalStateException { if (this.locked) throw Exceptions.traversalIsLocked(); step.setId(this.stepPosition.nextXId()); this.steps.add(index, step); final Step previousStep = this.steps.size() > 0 && index != 0 ? steps.get(index - 1) : null; final Step nextStep = this.steps.size() > index + 1 ? steps.get(index + 1) : null; step.setPreviousStep(null != previousStep ? previousStep : EmptyStep.instance()); step.setNextStep(null != nextStep ? nextStep : EmptyStep.instance()); if (null != previousStep) previousStep.setNextStep(step); if (null != nextStep) nextStep.setPreviousStep(step); step.setTraversal(this); return (Traversal.Admin<S2, E2>) this; }
if (null == stepPosition.parentId) stepPosition.parentId = ""; for (final Step<?, ?> step : traversal.getSteps()) { step.setId(stepPosition.nextXId());