andreachild commented on code in PR #3247:
URL: https://github.com/apache/tinkerpop/pull/3247#discussion_r2452821826
##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java:
##########
@@ -206,25 +210,40 @@ protected Iterator<Traverser.Admin<S>>
standardAlgorithm() throws NoSuchElementE
throw new IllegalStateException("The repeat()-traversal was not
defined: " + this);
while (true) {
- if (this.repeatTraversal.getEndStep().hasNext()) {
+ if (!first && this.repeatTraversal.getEndStep().hasNext()) {
return this.repeatTraversal.getEndStep();
} else {
- final Traverser.Admin<S> start = this.starts.next();
- start.initialiseLoops(this.getId(), this.loopName);
- if (doUntil(start, true)) {
- start.resetLoops();
- return IteratorUtils.of(start);
- }
- this.repeatTraversal.addStart(start);
- if (doEmit(start, true)) {
- final Traverser.Admin<S> emitSplit = start.split();
- emitSplit.resetLoops();
- return IteratorUtils.of(emitSplit);
+ this.first = false;
+ if
(!TraversalHelper.getStepsOfAssignableClassRecursively(Barrier.class,
repeatTraversal).isEmpty()) {
+ // If the repeatTraversal has a Barrier then make sure
that all starts are added to the
+ // repeatTraversal before it is iterated so that
RepeatStep always has "global" children.
+ if (!this.starts.hasNext())
+ throw FastNoSuchElementException.instance();
+ while (this.starts.hasNext()) {
+ processTraverser(this.starts.next());
+ }
+ } else {
+ return processTraverser(this.starts.next());
}
}
}
}
+ private Iterator<Traverser.Admin<S>> processTraverser(final
Traverser.Admin<S> start) {
Review Comment:
Nit: private method below public methods
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]