Java Code Examples for org.apache.tinkerpop.gremlin.process.traversal.Contains#within()

The following examples show how to use org.apache.tinkerpop.gremlin.process.traversal.Contains#within() . 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: GraphStep.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method for providers that want to "fold in" {@link HasContainer}'s based on id checking into the ids of the {@link GraphStep}.
 *
 * @param graphStep    the GraphStep to potentially {@link GraphStep#addIds(Object...)}.
 * @param hasContainer The {@link HasContainer} to check for id validation.
 * @return true if the {@link HasContainer} updated ids and thus, was processed.
 */
public static boolean processHasContainerIds(final GraphStep<?, ?> graphStep, final HasContainer hasContainer) {
    if (hasContainer.getKey().equals(T.id.getAccessor()) && graphStep.ids.length == 0 &&
            (hasContainer.getBiPredicate() == Compare.eq || hasContainer.getBiPredicate() == Contains.within)) {
        graphStep.addIds(hasContainer.getValue());
        return true;
    }
    return false;
}
 
Example 2
Source File: SqlgUtil.java    From sqlg with MIT License 4 votes vote down vote up
public static boolean isBulkWithinAndOut(SqlgGraph sqlgGraph, HasContainer hasContainer) {
    BiPredicate p = hasContainer.getPredicate().getBiPredicate();
    return (p == Contains.within || p == Contains.without) && ((Collection) hasContainer.getPredicate().getValue()).size() > sqlgGraph.configuration().getInt("bulk.within.count", BULK_WITHIN_COUNT);
}
 
Example 3
Source File: SqlgUtil.java    From sqlg with MIT License 4 votes vote down vote up
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public static boolean isBulkWithin(SqlgGraph sqlgGraph, HasContainer hasContainer) {
    BiPredicate p = hasContainer.getPredicate().getBiPredicate();
    return p == Contains.within && ((Collection) hasContainer.getPredicate().getValue()).size() > sqlgGraph.configuration().getInt("bulk.within.count", BULK_WITHIN_COUNT);
}