本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.Contains.within方法的典型用法代码示例。如果您正苦于以下问题:Java Contains.within方法的具体用法?Java Contains.within怎么用?Java Contains.within使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.process.traversal.Contains
的用法示例。
在下文中一共展示了Contains.within方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getContainsCondition
import org.apache.tinkerpop.gremlin.process.traversal.Contains; //导入方法依赖的package包/类
private Condition getContainsCondition(Object value, BiPredicate<?, ?> biPredicate, Field<Object> field) {
if (biPredicate == Contains.without) {
if (value == null) {
return field.isNull();
} else {
return field.notIn(value);
}
} else if (biPredicate == Contains.within) {
if (value == null) {
return field.isNotNull();
} else {
return field.in(((Collection) value).toArray());
}
}
return null;
}
示例2: addIdHasContainers
import org.apache.tinkerpop.gremlin.process.traversal.Contains; //导入方法依赖的package包/类
private void addIdHasContainers(SchemaTableTree schemaTableTree1, List<Multimap<BiPredicate, RecordId>> biPredicateRecordIds) {
if (biPredicateRecordIds != null) {
for (Multimap<BiPredicate, RecordId> biPredicateRecordId : biPredicateRecordIds) {
for (BiPredicate biPredicate : biPredicateRecordId.keySet()) {
Collection<RecordId> recordIds = biPredicateRecordId.get(biPredicate);
HasContainer idHasContainer;
//id hasContainers are only optimized for BaseStrategy.SUPPORTED_ID_BI_PREDICATE within, without, eq, neq
if (biPredicate == Contains.without || biPredicate == Contains.within) {
idHasContainer = new HasContainer(T.id.getAccessor(), P.test(biPredicate, recordIds));
schemaTableTree1.getHasContainers().add(idHasContainer);
} else {
Preconditions.checkState(biPredicate == Compare.eq || biPredicate == Compare.neq);
for (RecordId recordId : recordIds) {
idHasContainer = new HasContainer(T.id.getAccessor(), P.test(biPredicate, recordId));
schemaTableTree1.getHasContainers().add(idHasContainer);
}
}
}
}
}
}
示例3: processHasContainerIds
import org.apache.tinkerpop.gremlin.process.traversal.Contains; //导入方法依赖的package包/类
/**
* 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()) && (hasContainer.getBiPredicate() == Compare.eq || hasContainer.getBiPredicate() == Contains.within)) {
graphStep.addIds(hasContainer.getValue());
return true;
}
return false;
}
示例4: getContainsFilter
import org.apache.tinkerpop.gremlin.process.traversal.Contains; //导入方法依赖的package包/类
private static QueryBuilder getContainsFilter(String key, Object value, BiPredicate<?, ?> biPredicate) {
if (biPredicate == Contains.without) return QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery(key));
else if (biPredicate == Contains.within) {
if (value == null) return QueryBuilders.existsQuery(key);
else if (value instanceof Collection<?>)
return QueryBuilders.termsQuery(key, (Collection<?>) value);
else if (value.getClass().isArray())
return QueryBuilders.termsQuery(key, (Object[]) value);
else return QueryBuilders.termsQuery(key, value);
} else throw new IllegalArgumentException("predicate not supported by unipop: " + biPredicate.toString());
}
示例5: processHasContainerIds
import org.apache.tinkerpop.gremlin.process.traversal.Contains; //导入方法依赖的package包/类
/**
* 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;
}
示例6: getValueIterator
import org.apache.tinkerpop.gremlin.process.traversal.Contains; //导入方法依赖的package包/类
/**
* gets the requested values from the Has step. If it's a single value, wrap it in an array, otherwise return the array
*/
private Iterator<Object> getValueIterator(HasContainer c) {
return c.getPredicate().getBiPredicate() == Contains.within
? ((Iterable<Object>) c.getValue()).iterator()
: IteratorUtils.of(c.getValue());
}
示例7: collectSchemaTableTrees
import org.apache.tinkerpop.gremlin.process.traversal.Contains; //导入方法依赖的package包/类
private void collectSchemaTableTrees(
SqlgGraph sqlgGraph,
int replacedStepDepth,
Set<SchemaTableTree> result,
Map<SchemaTable, List<Multimap<BiPredicate, RecordId>>> groupedIds,
String table) {
SchemaTable schemaTable = SchemaTable.from(sqlgGraph, table);
List<HasContainer> schemaTableTreeHasContainers = new ArrayList<>(this.hasContainers);
if (groupedIds != null) {
List<Multimap<BiPredicate, RecordId>> biPredicateRecordIds = groupedIds.get(schemaTable.withOutPrefix());
if (biPredicateRecordIds != null) {
for (Multimap<BiPredicate, RecordId> biPredicateRecordId : biPredicateRecordIds) {
for (BiPredicate biPredicate : biPredicateRecordId.keySet()) {
Collection<RecordId> recordIds = biPredicateRecordId.get(biPredicate);
HasContainer idHasContainer;
//id hasContainers are only optimized for BaseStrategy.SUPPORTED_ID_BI_PREDICATE within, without, eq, neq
if (biPredicate == Contains.without || biPredicate == Contains.within) {
idHasContainer = new HasContainer(T.id.getAccessor(), P.test(biPredicate, recordIds));
schemaTableTreeHasContainers.add(idHasContainer);
} else {
Preconditions.checkState(biPredicate == Compare.eq || biPredicate == Compare.neq);
for (RecordId recordId : recordIds) {
idHasContainer = new HasContainer(T.id.getAccessor(), P.test(biPredicate, recordId));
schemaTableTreeHasContainers.add(idHasContainer);
}
}
}
}
}
}
SchemaTableTree schemaTableTree = new SchemaTableTree(
sqlgGraph,
schemaTable,
0,
schemaTableTreeHasContainers,
this.andOrHasContainers,
this.sqlgComparatorHolder,
this.sqlgComparatorHolder.getComparators(),
this.sqlgRangeHolder,
SchemaTableTree.STEP_TYPE.GRAPH_STEP,
ReplacedStep.this.emit,
ReplacedStep.this.untilFirst,
ReplacedStep.this.leftJoin,
ReplacedStep.this.drop,
replacedStepDepth,
ReplacedStep.this.labels
);
result.add(schemaTableTree);
}
示例8: isBulkWithinAndOut
import org.apache.tinkerpop.gremlin.process.traversal.Contains; //导入方法依赖的package包/类
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);
}
示例9: isBulkWithin
import org.apache.tinkerpop.gremlin.process.traversal.Contains; //导入方法依赖的package包/类
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);
}