Created
August 18, 2014 19:18
-
-
Save okram/b38ff96b8c334c63752c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class InjectStep<S> extends FilterStep<S> implements TraverserSource { | |
private final List<S> injections; | |
public InjectStep(final Traversal traversal, final S... injections) { | |
super(traversal); | |
this.setPredicate(t -> true); | |
this.injections = Arrays.asList(injections); | |
} | |
public void generateTraverserIterator(final boolean trackPaths) { | |
if (trackPaths) | |
this.addStarts(new TraverserIterator<>(this, this.injections.iterator())); | |
else | |
this.addStarts(new TraverserIterator<>(this.injections.iterator())); | |
} | |
public void clear() { | |
this.starts.clear(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment