本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchStep.MatchEndStep方法的典型用法代码示例。如果您正苦于以下问题:Java MatchStep.MatchEndStep方法的具体用法?Java MatchStep.MatchEndStep怎么用?Java MatchStep.MatchEndStep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchStep
的用法示例。
在下文中一共展示了MatchStep.MatchEndStep方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVariableLocations
import org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchStep; //导入方法依赖的package包/类
private static Set<Scoping.Variable> getVariableLocations(final Set<Scoping.Variable> variables, final Traversal.Admin<?, ?> traversal) {
if (variables.size() == 2) return variables; // has both START and END so no need to compute further
final Step<?, ?> startStep = traversal.getStartStep();
if (StartStep.isVariableStartStep(startStep))
variables.add(Scoping.Variable.START);
else if (startStep instanceof WherePredicateStep) {
if (((WherePredicateStep) startStep).getStartKey().isPresent())
variables.add(Scoping.Variable.START);
} else if (startStep instanceof WhereTraversalStep.WhereStartStep) {
if (!((WhereTraversalStep.WhereStartStep) startStep).getScopeKeys().isEmpty())
variables.add(Scoping.Variable.START);
} else if (startStep instanceof MatchStep.MatchStartStep) {
if (((MatchStep.MatchStartStep) startStep).getSelectKey().isPresent())
variables.add(Scoping.Variable.START);
} else if (startStep instanceof MatchStep) {
((MatchStep<?, ?>) startStep).getGlobalChildren().forEach(child -> TraversalHelper.getVariableLocations(variables, child));
} else if (startStep instanceof ConnectiveStep || startStep instanceof NotStep || startStep instanceof WhereTraversalStep)
((TraversalParent) startStep).getLocalChildren().forEach(child -> TraversalHelper.getVariableLocations(variables, child));
///
final Step<?, ?> endStep = traversal.getEndStep();
if (endStep instanceof WherePredicateStep) {
if (((WherePredicateStep) endStep).getStartKey().isPresent())
variables.add(Scoping.Variable.END);
} else if (endStep instanceof WhereTraversalStep.WhereEndStep) {
if (!((WhereTraversalStep.WhereEndStep) endStep).getScopeKeys().isEmpty())
variables.add(Scoping.Variable.END);
} else if (endStep instanceof MatchStep.MatchEndStep) {
if (((MatchStep.MatchEndStep) endStep).getMatchKey().isPresent())
variables.add(Scoping.Variable.END);
} else if (!endStep.getLabels().isEmpty())
variables.add(Scoping.Variable.END);
///
return variables;
}
示例2: getVariableLocations
import org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchStep; //导入方法依赖的package包/类
private static Set<Scoping.Variable> getVariableLocations(final Set<Scoping.Variable> variables, final Traversal.Admin<?, ?> traversal) {
if (variables.size() == 2) return variables; // has both START and END so no need to compute further
final Step<?, ?> startStep = traversal.getStartStep();
if (StartStep.isVariableStartStep(startStep))
variables.add(Scoping.Variable.START);
else if (startStep instanceof WherePredicateStep) {
if (((WherePredicateStep) startStep).getStartKey().isPresent())
variables.add(Scoping.Variable.START);
} else if (startStep instanceof WhereTraversalStep.WhereStartStep) {
if (!((WhereTraversalStep.WhereStartStep) startStep).getScopeKeys().isEmpty())
variables.add(Scoping.Variable.START);
} else if (startStep instanceof MatchStep.MatchStartStep) {
if (((MatchStep.MatchStartStep) startStep).getSelectKey().isPresent())
variables.add(Scoping.Variable.START);
} else if (startStep instanceof MatchStep) {
for (final Traversal.Admin<?, ?> global : ((MatchStep<?, ?>) startStep).getGlobalChildren()) {
TraversalHelper.getVariableLocations(variables, global);
}
} else if (startStep instanceof ConnectiveStep || startStep instanceof NotStep || startStep instanceof WhereTraversalStep) {
for (final Traversal.Admin<?, ?> local : ((TraversalParent) startStep).getLocalChildren()) {
TraversalHelper.getVariableLocations(variables, local);
}
}
///
final Step<?, ?> endStep = traversal.getEndStep();
if (endStep instanceof WherePredicateStep) {
if (((WherePredicateStep) endStep).getStartKey().isPresent())
variables.add(Scoping.Variable.END);
} else if (endStep instanceof WhereTraversalStep.WhereEndStep) {
if (!((WhereTraversalStep.WhereEndStep) endStep).getScopeKeys().isEmpty())
variables.add(Scoping.Variable.END);
} else if (endStep instanceof MatchStep.MatchEndStep) {
if (((MatchStep.MatchEndStep) endStep).getMatchKey().isPresent())
variables.add(Scoping.Variable.END);
} else if (!endStep.getLabels().isEmpty())
variables.add(Scoping.Variable.END);
///
return variables;
}
示例3: doStrategy
import org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchStep; //导入方法依赖的package包/类
private boolean doStrategy(final Step step) {
if (!(step instanceof CountGlobalStep) ||
!(step.getNextStep() instanceof IsStep) ||
step.getPreviousStep() instanceof RangeGlobalStep) // if a RangeStep was provided, assume that the user knows what he's doing
return false;
final Step parent = step.getTraversal().getParent().asStep();
return (parent instanceof FilterStep || parent.getLabels().isEmpty()) && // if the parent is labeled, then the count matters
!(parent.getNextStep() instanceof MatchStep.MatchEndStep && // if this is in a pattern match, then don't do it.
((MatchStep.MatchEndStep) parent.getNextStep()).getMatchKey().isPresent());
}