Java Code Examples for org.apache.tinkerpop.gremlin.process.traversal.Path#forEach()

The following examples show how to use org.apache.tinkerpop.gremlin.process.traversal.Path#forEach() . 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: DetachedPath.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
protected DetachedPath(final Path path, final boolean withProperties) {
    path.forEach((object, labels) -> {
        if (object instanceof DetachedElement || object instanceof DetachedProperty || object instanceof DetachedPath)
            this.objects.add(object);
        else
            this.objects.add(DetachedFactory.detach(object, withProperties));

        //Make a copy of the labels as its an UnmodifiableSet which can not be serialized.
        this.labels.add(new LinkedHashSet<>(labels));
    });
}
 
Example 2
Source File: ReferencePath.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
protected ReferencePath(final Path path) {
    path.forEach((object, labels) -> {
        if (object instanceof ReferenceElement || object instanceof ReferenceProperty || object instanceof ReferencePath)
            this.objects.add(object);
        else
            this.objects.add(ReferenceFactory.detach(object));
        this.labels.add(new HashSet<>(labels));
    });
}
 
Example 3
Source File: PathStep.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
protected Path map(final Traverser.Admin<S> traverser) {
    final Path path = traverser.path().subPath(this.fromLabel, this.toLabel);
    if (this.traversalRing.isEmpty())
        return path;
    else {
        this.traversalRing.reset();
        final Path byPath = MutablePath.make();
        path.forEach((object, labels) -> byPath.extend(TraversalUtil.applyNullable(object, this.traversalRing.next()), labels));
        return byPath;
    }
}
 
Example 4
Source File: PathFilterStep.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean filter(final Traverser.Admin<S> traverser) {
    final Path path = traverser.path().subPath(this.fromLabel, this.toLabel);
    if (this.traversalRing.isEmpty())
        return path.isSimple() == this.isSimple;
    else {
        this.traversalRing.reset();
        final Path byPath = MutablePath.make();
        path.forEach((object, labels) -> byPath.extend(TraversalUtil.applyNullable(object, this.traversalRing.next()), labels));
        return byPath.isSimple() == this.isSimple;
    }
}