• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EmptyStep类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep的典型用法代码示例。如果您正苦于以下问题:Java EmptyStep类的具体用法?Java EmptyStep怎么用?Java EmptyStep使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EmptyStep类属于org.apache.tinkerpop.gremlin.process.traversal.step.util包,在下文中一共展示了EmptyStep类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    if (!(traversal.getParent() instanceof EmptyStep) || TraversalHelper.onGraphComputer(traversal))
        return;
    final List<Step> steps = traversal.getSteps();
    if (steps.size() < 2 ||
            !(steps.get(0) instanceof GraphStep) ||
            0 != ((GraphStep) steps.get(0)).getIds().length ||
            !(steps.get(steps.size() - 1) instanceof CountGlobalStep))
        return;
    for (int i = 1; i < steps.size() - 1; i++) {
        final Step current = steps.get(i);
        if (!(current instanceof MapStep ||
                current instanceof IdentityStep ||
                current instanceof NoOpBarrierStep ||
                current instanceof CollectingBarrierStep) ||
                (current instanceof TraversalParent &&
                        TraversalHelper.anyStepRecursively(s -> (s instanceof SideEffectStep || s instanceof AggregateStep), (TraversalParent) current)))
            return;
    }
    final Class<? extends Element> elementClass = ((GraphStep<?, ?>) steps.get(0)).getReturnClass();
    TraversalHelper.removeAllSteps(traversal);
    traversal.addStep(new TinkerCountGlobalStep<>(traversal, elementClass));
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:25,代码来源:TinkerGraphCountStrategy.java


示例2: determineStartLabelForHasPullOut

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
private String determineStartLabelForHasPullOut(final MatchStep<?, ?> matchStep) {
    if (!(matchStep.getTraversal().getParent() instanceof EmptyStep))
        return null;
    else {
        final String startLabel = MatchStep.Helper.computeStartLabel(matchStep.getGlobalChildren());
        Step<?, ?> previousStep = matchStep.getPreviousStep();
        if (previousStep.getLabels().contains(startLabel))
            return startLabel;
        while (!(previousStep instanceof EmptyStep)) {
            if (!previousStep.getLabels().isEmpty())
                return null;
            previousStep = previousStep.getPreviousStep();
        }
        return startLabel;
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:17,代码来源:MatchPredicateStrategy.java


示例3: getAllPropertyFetchersOf

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
private List<PropertyFetcher> getAllPropertyFetchersOf(Step step, Traversal.Admin<?, ?> traversal) {
    List<PropertyFetcher> propertyFetchers = new ArrayList<>();
    Step previous = step.getPreviousStep();
    while (!(previous instanceof EmptyStep)) {
        if (previous instanceof PropertyFetcher)
            propertyFetchers.add((PropertyFetcher) previous);
        if (previous instanceof TraversalParent) {
            ((TraversalParent) previous).getLocalChildren()
                    .forEach(t -> t.getSteps().stream()
                            .filter(s -> s instanceof PropertyFetcher)
                            .map(p -> ((PropertyFetcher) p)).forEach(propertyFetchers::add));
            ((TraversalParent) previous).getGlobalChildren()
                    .forEach(t -> t.getSteps().stream()
                            .filter(s -> s instanceof PropertyFetcher)
                            .map(p -> ((PropertyFetcher) p)).forEach(propertyFetchers::add));
        }
        previous = previous.getPreviousStep();
    }
    return propertyFetchers;
}
 
开发者ID:unipop-graph,项目名称:unipop,代码行数:21,代码来源:UniGraphPropertiesStrategy.java


示例4: getReferencedLabels

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
public static Set<String> getReferencedLabels(final Step step) {
    final Set<String> referencedLabels = new HashSet<>();

    if (step instanceof Scoping) {
        final Set<String> labels = new HashSet<>(((Scoping) step).getScopeKeys());
        if (step instanceof MatchStep) {
            // if this is the last step, keep everything, else just add founds
            if (step.getNextStep() instanceof EmptyStep) {
                labels.addAll(((MatchStep) step).getMatchEndLabels());
                labels.addAll(((MatchStep) step).getMatchStartLabels());
            }
        }
        referencedLabels.addAll(labels);

    }

    return referencedLabels;
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:19,代码来源:PathUtil.java


示例5: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    if ((traversal.getParent() instanceof EmptyStep || traversal.getParent() instanceof VertexProgramStep) &&
            TraversalHelper.hasStepOfAssignableClassRecursively(ProfileSideEffectStep.class, traversal))
        TraversalHelper.applyTraversalRecursively(t -> t.getEndStep().addLabel(MARKER), traversal);
    if (traversal.getEndStep().getLabels().contains(MARKER)) {
        traversal.getEndStep().removeLabel(MARKER);
        // Add .profile() step after every pre-existing step.
        final List<Step> steps = traversal.getSteps();
        final int numSteps = steps.size();
        for (int i = 0; i < numSteps; i++) {
            // Do not inject profiling after ProfileSideEffectStep as this will be the last step on the root traversal.
            if (steps.get(i * 2) instanceof ProfileSideEffectStep)
                break;
            // Create and inject ProfileStep
            traversal.addStep((i * 2) + 1, new ProfileStep(traversal));
        }
    }
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:20,代码来源:ProfileStrategy.java


示例6: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    // using a hidden label marker to denote whether the traversal should not be processed by this strategy
    if ((traversal.getParent() instanceof EmptyStep || traversal.getParent() instanceof VertexProgramStep) &&
            TraversalHelper.hasStepOfAssignableClassRecursively(INVALIDATING_STEP_CLASSES, traversal))
        TraversalHelper.applyTraversalRecursively(t -> t.getStartStep().addLabel(MARKER), traversal);
    if (traversal.getStartStep().getLabels().contains(MARKER)) {
        traversal.getStartStep().removeLabel(MARKER);
        return;
    }
    ////////////////////////////////////////////////////////////////////////////
    final Collection<Pair<VertexStep, Step>> stepsToReplace = new ArrayList<>();
    Step prev = null;
    for (final Step curr : traversal.getSteps()) {
        if (isOptimizable(prev, curr)) {
            stepsToReplace.add(Pair.with((VertexStep) prev, curr));
        }
        prev = curr;
    }
    if (!stepsToReplace.isEmpty()) {
        for (final Pair<VertexStep, Step> pair : stepsToReplace) {
            optimizeSteps(traversal, pair.getValue0(), pair.getValue1());
        }
    }
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:26,代码来源:IncidentToAdjacentStrategy.java


示例7: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    boolean changed = true; // recursively walk child traversals trying to inline them into the current traversal line.
    while (changed) {
        changed = false;
        final Iterator<FilterStep> filterStepIterator = TraversalHelper.getStepsOfAssignableClass(FilterStep.class, traversal).iterator();
        while (!changed && filterStepIterator.hasNext()) {
            final FilterStep<?> step = filterStepIterator.next();
            changed = step instanceof HasStep && InlineFilterStrategy.processHasStep((HasStep) step, traversal) ||
                    step instanceof TraversalFilterStep && InlineFilterStrategy.processTraversalFilterStep((TraversalFilterStep) step, traversal) ||
                    step instanceof OrStep && InlineFilterStrategy.processOrStep((OrStep) step, traversal) ||
                    step instanceof AndStep && InlineFilterStrategy.processAndStep((AndStep) step, traversal);
        }
        if (!changed && traversal.getParent() instanceof EmptyStep) {
            final Iterator<MatchStep> matchStepIterator = TraversalHelper.getStepsOfClass(MatchStep.class, traversal).iterator();
            while (!changed && matchStepIterator.hasNext()) {
                if (InlineFilterStrategy.processMatchStep(matchStepIterator.next(), traversal))
                    changed = true;
            }
        }
    }
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:23,代码来源:InlineFilterStrategy.java


示例8: processesPropertyType

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
private static final char processesPropertyType(Step step) {
    while (!(step instanceof EmptyStep)) {
        if (step instanceof FilterStep || step instanceof SideEffectStep)
            step = step.getPreviousStep();
        else if (step instanceof GraphStep && ((GraphStep) step).returnsVertex())
            return 'v';
        else if (step instanceof EdgeVertexStep)
            return 'v';
        else if (step instanceof VertexStep)
            return ((VertexStep) step).returnsVertex() ? 'v' : 'p';
        else if (step instanceof PropertyMapStep || step instanceof PropertiesStep)
            return 'p';
        else
            return 'x';
    }
    return 'x';
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:18,代码来源:SubgraphStrategy.java


示例9: removeToTraversal

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
public static <S, E> void removeToTraversal(final Step<S, ?> startStep, final Step<?, E> endStep, final Traversal.Admin<S, E> newTraversal) {
    final Traversal.Admin<?, ?> originalTraversal = startStep.getTraversal();
    Step<?, ?> currentStep = startStep;
    while (currentStep != endStep && !(currentStep instanceof EmptyStep)) {
        final Step<?, ?> temp = currentStep.getNextStep();
        originalTraversal.removeStep(currentStep);
        newTraversal.addStep(currentStep);
        currentStep = temp;
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:11,代码来源:TraversalHelper.java


示例10: isGlobalChild

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
public static boolean isGlobalChild(Traversal.Admin<?, ?> traversal) {
    while (!(traversal.getParent() instanceof EmptyStep)) {
        if (traversal.getParent().getLocalChildren().contains(traversal))
            return false;
        traversal = traversal.getParent().asStep().getTraversal();
    }
    return true;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:9,代码来源:TraversalHelper.java


示例11: reIdSteps

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
public static void reIdSteps(final StepPosition stepPosition, final Traversal.Admin<?, ?> traversal) {
    stepPosition.x = 0;
    stepPosition.y = -1;
    stepPosition.z = -1;
    stepPosition.parentId = null;
    Traversal.Admin<?, ?> current = traversal;
    while (!(current instanceof EmptyTraversal)) {
        stepPosition.y++;
        final TraversalParent parent = current.getParent();
        if (null == stepPosition.parentId && !(parent instanceof EmptyStep))
            stepPosition.parentId = parent.asStep().getId();
        if (-1 == stepPosition.z) {
            final int globalChildrenSize = parent.getGlobalChildren().size();
            for (int i = 0; i < globalChildrenSize; i++) {
                if (parent.getGlobalChildren().get(i) == current) {
                    stepPosition.z = i;
                }
            }
            for (int i = 0; i < parent.getLocalChildren().size(); i++) {
                if (parent.getLocalChildren().get(i) == current) {
                    stepPosition.z = i + globalChildrenSize;
                }
            }
        }
        current = parent.asStep().getTraversal();
    }
    if (-1 == stepPosition.z) stepPosition.z = 0;
    if (null == stepPosition.parentId) stepPosition.parentId = "";
    for (final Step<?, ?> step : traversal.getSteps()) {
        step.setId(stepPosition.nextXId());
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:33,代码来源:TraversalHelper.java


示例12: onGraphComputer

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
public static boolean onGraphComputer(Traversal.Admin<?, ?> traversal) {
    while (!(traversal.getParent() instanceof EmptyStep)) {
        if (traversal.getParent().asStep() instanceof TraversalVertexProgramStep)
            return true;
        traversal = traversal.getParent().asStep().getTraversal();
    }
    return false;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:9,代码来源:TraversalHelper.java


示例13: getTraverserGenerator

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
@Override
public TraverserGenerator getTraverserGenerator() {
    if (null == this.generator)
        this.generator = (this.parent instanceof EmptyStep) ?
                DefaultTraverserGeneratorFactory.instance().getTraverserGenerator(this.getTraverserRequirements()) :
                TraversalHelper.getRootTraversal(this).getTraverserGenerator();
    return this.generator;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:9,代码来源:DefaultTraversal.java


示例14: applyStrategies

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
@Override
public void applyStrategies() throws IllegalStateException {
    if (this.locked) throw Traversal.Exceptions.traversalIsLocked();
    TraversalHelper.reIdSteps(this.stepPosition, this);
    this.strategies.applyStrategies(this);
    boolean hasGraph = null != this.graph;
    for (final Step<?, ?> step : this.getSteps()) {
        if (step instanceof TraversalParent) {
            for (final Traversal.Admin<?, ?> globalChild : ((TraversalParent) step).getGlobalChildren()) {
                globalChild.setStrategies(this.strategies);
                globalChild.setSideEffects(this.sideEffects);
                if (hasGraph) globalChild.setGraph(this.graph);
                globalChild.applyStrategies();
            }
            for (final Traversal.Admin<?, ?> localChild : ((TraversalParent) step).getLocalChildren()) {
                localChild.setStrategies(this.strategies);
                localChild.setSideEffects(this.sideEffects);
                if (hasGraph) localChild.setGraph(this.graph);
                localChild.applyStrategies();
            }
        }
    }
    this.finalEndStep = this.getEndStep();
    // finalize requirements
    if (this.getParent() instanceof EmptyStep) {
        this.requirements = null;
        this.getTraverserRequirements();
    }
    this.locked = true;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:31,代码来源:DefaultTraversal.java


示例15: addStep

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
@Override
public <S2, E2> Traversal.Admin<S2, E2> addStep(final int index, final Step<?, ?> step) throws IllegalStateException {
    if (this.locked) throw Exceptions.traversalIsLocked();
    step.setId(this.stepPosition.nextXId());
    this.steps.add(index, step);
    final Step previousStep = this.steps.size() > 0 && index != 0 ? steps.get(index - 1) : null;
    final Step nextStep = this.steps.size() > index + 1 ? steps.get(index + 1) : null;
    step.setPreviousStep(null != previousStep ? previousStep : EmptyStep.instance());
    step.setNextStep(null != nextStep ? nextStep : EmptyStep.instance());
    if (null != previousStep) previousStep.setNextStep(step);
    if (null != nextStep) nextStep.setPreviousStep(step);
    step.setTraversal(this);
    return (Traversal.Admin<S2, E2>) this;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:15,代码来源:DefaultTraversal.java


示例16: removeStep

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
@Override
public <S2, E2> Traversal.Admin<S2, E2> removeStep(final int index) throws IllegalStateException {
    if (this.locked) throw Exceptions.traversalIsLocked();
    final Step previousStep = this.steps.size() > 0 && index != 0 ? steps.get(index - 1) : null;
    final Step nextStep = this.steps.size() > index + 1 ? steps.get(index + 1) : null;
    //this.steps.get(index).setTraversal(EmptyTraversal.instance());
    this.steps.remove(index);
    if (null != previousStep) previousStep.setNextStep(null == nextStep ? EmptyStep.instance() : nextStep);
    if (null != nextStep) nextStep.setPreviousStep(null == previousStep ? EmptyStep.instance() : previousStep);
    return (Traversal.Admin<S2, E2>) this;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:12,代码来源:DefaultTraversal.java


示例17: getReferencedLabelsAfterStep

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
public static Set<String> getReferencedLabelsAfterStep(Step<?, ?> step) {
    final Set<String> labels = new HashSet<>();
    while (!(step instanceof EmptyStep)) {
        labels.addAll(PathUtil.getReferencedLabels(step));
        step = step.getNextStep();
    }
    return labels;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:9,代码来源:PathUtil.java


示例18: getReferencedLabels

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
public static Set<String> getReferencedLabels(final Step step) {
    final Set<String> referencedLabels = new HashSet<>();

    if (step instanceof Parameterizing) { // TODO: we should really make the mutation steps Scoping :|
        final Parameters parameters = ((Parameterizing) step).getParameters();
        for (final Traversal.Admin trav : parameters.getTraversals()) {
            for (final Object ss : trav.getSteps()) {
                if (ss instanceof Scoping) {
                    for (String label : ((Scoping) ss).getScopeKeys()) {
                        referencedLabels.add(label);
                    }
                }
            }
        }
    }

    if (step instanceof Scoping) {
        final Set<String> labels = new HashSet<>(((Scoping) step).getScopeKeys());
        if (step instanceof MatchStep) {
            // if this is the last step, keep everything, else just add founds
            if (step.getNextStep() instanceof EmptyStep) {
                labels.addAll(((MatchStep) step).getMatchEndLabels());
                labels.addAll(((MatchStep) step).getMatchStartLabels());
            }
        }
        referencedLabels.addAll(labels);

    }

    return referencedLabels;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:32,代码来源:PathUtil.java


示例19: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    if (traversal.getSteps().size() <= 1 || !TraversalHelper.hasStepOfClass(IdentityStep.class, traversal))
        return;

    TraversalHelper.getStepsOfClass(IdentityStep.class, traversal).stream().forEach(identityStep -> {
        final Step<?, ?> previousStep = identityStep.getPreviousStep();
        if (!(previousStep instanceof EmptyStep) || identityStep.getLabels().isEmpty()) {
            ((IdentityStep<?>) identityStep).getLabels().forEach(previousStep::addLabel);
            traversal.removeStep(identityStep);
        }
    });
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:14,代码来源:IdentityRemovalStrategy.java


示例20: previousTraversalVertexProgram

import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; //导入依赖的package包/类
protected boolean previousTraversalVertexProgram() {
    Step<?, ?> currentStep = this;
    while (!(currentStep instanceof EmptyStep)) {
        if (currentStep instanceof TraversalVertexProgramStep)
            return true;
        currentStep = currentStep.getPreviousStep();
    }
    return false;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:VertexProgramStep.java



注:本文中的org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java State类代码示例发布时间:2022-05-22
下一篇:
Java IslamicChronology类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap