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

The following examples show how to use org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil#test() . 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: OrStep.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean filter(final Traverser.Admin<S> traverser) {
    for (final Traversal.Admin<S, ?> traversal : this.traversals) {
        if (TraversalUtil.test(traverser, traversal))
            return true;
    }
    return false;
}
 
Example 2
Source File: AndStep.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean filter(final Traverser.Admin<S> traverser) {
    for (final Traversal.Admin<S, ?> traversal : this.traversals) {
        if (!TraversalUtil.test(traverser, traversal))
            return false;
    }
    return true;
}
 
Example 3
Source File: BranchStep.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
private List<Traversal.Admin<S, E>> pickBranches(final Object choice) {
    final List<Traversal.Admin<S, E>> branches = new ArrayList<>();
    if (choice instanceof Pick) {
        if (this.traversalPickOptions.containsKey(choice)) {
            branches.addAll(this.traversalPickOptions.get(choice));
        }
    }
    for (final Pair<Traversal.Admin, Traversal.Admin<S, E>> p : this.traversalOptions) {
        if (TraversalUtil.test(choice, p.getValue0())) {
            branches.add(p.getValue1());
        }
    }
    return branches.isEmpty() ? this.traversalPickOptions.get(Pick.none) : branches;
}
 
Example 4
Source File: SqlgOrStepBarrier.java    From sqlg with MIT License 5 votes vote down vote up
@Override
protected boolean filter(final Traverser.Admin<S> traverser) {
    for (final Traversal.Admin<S, ?> traversal : this.traversals) {
        if (TraversalUtil.test(traverser, traversal))
            return true;
    }
    return false;
}
 
Example 5
Source File: SqlgAndStepBarrier.java    From sqlg with MIT License 5 votes vote down vote up
@Override
protected boolean filter(final Traverser.Admin<S> traverser) {
    for (final Traversal.Admin<S, ?> traversal : this.traversals) {
        if (TraversalUtil.test(traverser, traversal))
            return true;
    }
    return false;
}
 
Example 6
Source File: NotStep.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean filter(final Traverser.Admin<S> traverser) {
    return !TraversalUtil.test(traverser, this.notTraversal);
}
 
Example 7
Source File: TraversalFilterStep.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean filter(final Traverser.Admin<S> traverser) {
    return TraversalUtil.test(traverser, this.filterTraversal);
}
 
Example 8
Source File: WhereTraversalStep.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean filter(final Traverser.Admin<S> traverser) {
    return TraversalUtil.test((Traverser.Admin) traverser, this.whereTraversal);
}
 
Example 9
Source File: RepeatStep.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
public final boolean doUntil(final Traverser.Admin<S> traverser, boolean utilFirst) {
    return utilFirst == this.untilFirst && null != this.untilTraversal && TraversalUtil.test(traverser, this.untilTraversal);
}
 
Example 10
Source File: RepeatStep.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
public final boolean doEmit(final Traverser.Admin<S> traverser, boolean emitFirst) {
    return emitFirst == this.emitFirst && null != this.emitTraversal && TraversalUtil.test(traverser, this.emitTraversal);
}
 
Example 11
Source File: SqlgRepeatStepBarrier.java    From sqlg with MIT License 4 votes vote down vote up
private boolean doUntil(final Traverser.Admin<S> traverser, boolean utilFirst) {
    return utilFirst == this.untilFirst && null != this.untilTraversal && TraversalUtil.test(traverser, this.untilTraversal);
}
 
Example 12
Source File: SqlgRepeatStepBarrier.java    From sqlg with MIT License 4 votes vote down vote up
private boolean doEmit(final Traverser.Admin<S> traverser, boolean emitFirst) {
    return emitFirst == this.emitFirst && null != this.emitTraversal && TraversalUtil.test(traverser, this.emitTraversal);
}
 
Example 13
Source File: GraphFilter.java    From tinkerpop with Apache License 2.0 2 votes vote down vote up
/**
 * Returns true if the provided vertex meets the vertex-filter criteria.
 * If no vertex filter is provided, then the vertex is considered legal.
 *
 * @param vertex the vertex to test for legality
 * @return whether the vertex is {@link Legal#YES}.
 */
public boolean legalVertex(final Vertex vertex) {
    return null == this.vertexFilter || TraversalUtil.test(vertex, this.vertexFilter);
}