Java Code Examples for org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil#applyAll()

The following examples show how to use org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil#applyAll() . 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: TraversalSelectStep.java    From tinkerpop with Apache License 2.0 6 votes vote down vote up
@Override
protected Traverser.Admin<E> processNextStart() {
    final Traverser.Admin<S> traverser = this.starts.next();
    final Iterator<E> keyIterator = TraversalUtil.applyAll(traverser, this.keyTraversal);
    if (keyIterator.hasNext()) {
        final E key = keyIterator.next();
        try {
            final E end = getScopeValue(pop, key, traverser);
            final Traverser.Admin<E> outTraverser = traverser.split(null == end ? null : TraversalUtil.applyNullable(end, this.selectTraversal), this);
            if (!(this.getTraversal().getParent() instanceof MatchStep)) {
                PathProcessor.processTraverserPathLabels(outTraverser, this.keepLabels);
            }
            return outTraverser;
        } catch (KeyNotFoundException nfe) {
            return EmptyTraverser.instance();
        }
    } else {
        return EmptyTraverser.instance();
    }
}
 
Example 2
Source File: TraversalFlatMapStep.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
protected Iterator<E> flatMap(final Traverser.Admin<S> traverser) {
    return TraversalUtil.applyAll(traverser, this.flatMapTraversal);
}
 
Example 3
Source File: TraversalMapStep.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
protected Traverser.Admin<E> processNextStart() throws NoSuchElementException {
    final Traverser.Admin<S> traverser = this.starts.next();
    final Iterator<E> iterator = TraversalUtil.applyAll(traverser, this.mapTraversal);
    return  iterator.hasNext() ? traverser.split(iterator.next(), this) : EmptyTraverser.instance();
}
 
Example 4
Source File: TraversalSideEffectStep.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
protected void sideEffect(final Traverser.Admin<S> traverser) {
    final Iterator<?> iterator = TraversalUtil.applyAll(traverser, this.sideEffectTraversal);
    while (iterator.hasNext()) iterator.next();
}
 
Example 5
Source File: GraphFilter.java    From tinkerpop with Apache License 2.0 2 votes vote down vote up
/**
 * Returns an iterator of legal edges incident to the provided vertex.
 * If no edge filter is provided, then all incident edges are returned.
 *
 * @param vertex the vertex whose legal edges are to be access.
 * @return an iterator of edges that are {@link Legal#YES}.
 */
public Iterator<Edge> legalEdges(final Vertex vertex) {
    return null == this.edgeFilter ?
            vertex.edges(Direction.BOTH) :
            TraversalUtil.applyAll(vertex, this.edgeFilter);
}