当前位置: 首页>>代码示例>>Java>>正文


Java Step.setId方法代码示例

本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.Step.setId方法的典型用法代码示例。如果您正苦于以下问题:Java Step.setId方法的具体用法?Java Step.setId怎么用?Java Step.setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tinkerpop.gremlin.process.traversal.Step的用法示例。


在下文中一共展示了Step.setId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reIdSteps

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入方法依赖的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

示例2: addStep

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入方法依赖的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


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