當前位置: 首頁>>代碼示例>>Java>>正文


Java MatchStep.MatchEndStep方法代碼示例

本文整理匯總了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;
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:35,代碼來源:TraversalHelper.java

示例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;
}
 
開發者ID:apache,項目名稱:tinkerpop,代碼行數:40,代碼來源:TraversalHelper.java

示例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());
}
 
開發者ID:apache,項目名稱:tinkerpop,代碼行數:12,代碼來源:CountStrategy.java


注:本文中的org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchStep.MatchEndStep方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。