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

Java BranchState类代码示例

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

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



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

示例1: expand

import org.neo4j.graphdb.traversal.BranchState; //导入依赖的package包/类
@Override
public Iterable<Relationship> expand(Path path, BranchState<Double> branchState) {
    ArrayList<Relationship> rels = new ArrayList<>();
    Node endNode = path.endNode();
    Double voltage = (Double) endNode.getProperty("voltage", 999.0);
    if (voltage <= branchState.getState()) {
        // Set the new voltage
        branchState.setState(voltage);

        endNode.getRelationships(Direction.OUTGOING, RelationshipTypes.CONNECTED).forEach(rel -> {
            if ((Boolean)rel.getProperty("incoming_switch_on", false) &&
                (Boolean)rel.getProperty("outgoing_switch_on", false)) {
                rels.add(rel);
            }
        });
    }

    return rels;
}
 
开发者ID:maxdemarzi,项目名称:power_grid,代码行数:20,代码来源:EnergizationExpander.java


示例2: expand

import org.neo4j.graphdb.traversal.BranchState; //导入依赖的package包/类
@Override
public Iterable<Relationship> expand(Path path, BranchState state) {
    if (System.currentTimeMillis() < stopTime) {
        switch (path.length()) {
            case 0:
                return path.endNode().getRelationships(Direction.OUTGOING, RelationshipTypes.HAS_DESTINATION);
            case 1: {
                Node lastNode = path.endNode();
                if (destinations.contains((String) lastNode.getProperty("code"))) {
                    return path.endNode().getRelationships(Direction.OUTGOING, relationshipTypes);
                } else {
                    return Collections.emptyList();
                }
            }
             case 2:
             case 3: {
                 return path.endNode().getRelationships(Direction.OUTGOING, relationshipTypes);
             }
            default:
                return Collections.emptyList();
        }
    } else {
        return Collections.emptyList();
    }
}
 
开发者ID:maxdemarzi,项目名称:neo_airlines,代码行数:26,代码来源:NonStopExpander.java


示例3: expand

import org.neo4j.graphdb.traversal.BranchState; //导入依赖的package包/类
@Override
public final Iterable<Relationship> expand(final Path path, final BranchState state) {

    List<Relationship> result = new ArrayList<>();

    if (this.since == Long.MIN_VALUE && this.until == Long.MAX_VALUE) {
        return path.endNode().getRelationships();
    }

    if (path.length() >= this.depth) {
        return result;
    }

    for (Relationship rel : path.endNode().getRelationships()) {
        long current = Long.parseLong(rel.getProperty("timestamp").toString());
        if (until > current && current > since) {
            result.add(rel);
        }
    }

    return result;
}
 
开发者ID:inveniosoftware-contrib,项目名称:obelix,代码行数:23,代码来源:TimeStampExpander.java


示例4: buildStepExpander

import org.neo4j.graphdb.traversal.BranchState; //导入依赖的package包/类
private StepExpander buildStepExpander( RelationshipFilterDescriptor relationshipDescriptor )
{
    List<PropertyContainerPredicate> relationshipPredicateList = relationshipDescriptor.getFilterPredicates();

    final PredicateGroup<PropertyContainer> relationshipPredicates = ( relationshipPredicateList.isEmpty() ) ? null
            : new PredicateGroup<PropertyContainer>(
                    relationshipPredicateList.toArray( new PropertyContainerPredicate[relationshipPredicateList.size()] ) );

    final Function<Node, Iterator<Relationship>> expandFun = relationshipDescriptor.expandFun();

    return new StepExpander()
    {
        @Override
        public Iterable<Relationship> expand( Path path, BranchState<StepState> state )
        {
            final Node startNode = path.endNode();
            Iterator<Relationship> relationships = ( null == relationshipPredicates ) ? expandFun.apply( startNode )
                    : Iterators.filter( expandFun.apply( startNode ), relationshipPredicates );
            return ImmutableList.copyOf( relationships );
        }
    };
}
 
开发者ID:alexaverbuch,项目名称:steps,代码行数:23,代码来源:StepsBuilder.java


示例5: expand

import org.neo4j.graphdb.traversal.BranchState; //导入依赖的package包/类
@Override
public Iterable<Relationship> expand(Path path, BranchState state) {
  List<Relationship> children = CHILDREN_ORDER.sortedCopy(path.endNode().getRelationships(RelType.PARENT_OF, Direction.OUTGOING));
  if (synRels.isEmpty()) {
    return children;
  } else {
    List<Iterable<Relationship>> synResults = Lists.newArrayList();
    for (RelType rt : synRels) {
      synResults.add(path.endNode().getRelationships(rt, Direction.INCOMING));
    }
    return Iterables.concat(
        SYNONYM_ORDER.sortedCopy(Iterables.concat(synResults)),
        children
    );
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:17,代码来源:TaxonomicOrderExpander.java


示例6: expand

import org.neo4j.graphdb.traversal.BranchState; //导入依赖的package包/类
@Override
public Iterable<Relationship> expand(Path path, BranchState branchState) {
    if (path.endNode().hasLabel(stopLabel)) {
        return Collections.emptyList();
    }
    if (path.length() % 2 == 0) {
        return path.endNode().getRelationships(Direction.INCOMING);
    } else {
        return path.endNode().getRelationships(Direction.OUTGOING);
    }
}
 
开发者ID:maxdemarzi,项目名称:cypher_hip_hop,代码行数:12,代码来源:HipHopExpander.java


示例7: evaluate

import org.neo4j.graphdb.traversal.BranchState; //导入依赖的package包/类
@Override
public Evaluation evaluate(Path path, BranchState branchState) {
    if (path.endNode().hasLabel(stopLabel)) {
        return Evaluation.EXCLUDE_AND_PRUNE;
    } else {
        return Evaluation.INCLUDE_AND_CONTINUE;
    }
}
 
开发者ID:maxdemarzi,项目名称:cypher_hip_hop,代码行数:9,代码来源:HipHopEvaluator.java


示例8: evaluate

import org.neo4j.graphdb.traversal.BranchState; //导入依赖的package包/类
@Override
public Evaluation evaluate(Path path, BranchState<Double> branchState) {
    // Path with just the single node, ignore it and continue
    if (path.length() == 0 ) {
        return Evaluation.INCLUDE_AND_CONTINUE;
    }
    // Make sure last Equipment voltage is equal to or lower than previous voltage
    Double voltage = (Double) path.endNode().getProperty("voltage", 999.0);
    if (voltage <= branchState.getState()) {
        return Evaluation.INCLUDE_AND_CONTINUE;
    } else {
        return Evaluation.EXCLUDE_AND_PRUNE;
    }
}
 
开发者ID:maxdemarzi,项目名称:power_grid,代码行数:15,代码来源:EnergizationEvaluator.java


示例9: expand

import org.neo4j.graphdb.traversal.BranchState; //导入依赖的package包/类
@Override
public Iterable<Relationship> expand( Path path, BranchState<StepState> state )
{
    StepExpander stepExpander = stepExpanders[state.getState().step()];
    /*
     * Return List because Iterable should be capable of returning multiple Iterator instances
     * Wrapping Iterator in an Iterable that can only consume it once would break the Iterable contract
     */
    return ImmutableList.copyOf( stepExpander.expand( path, state ) );
}
 
开发者ID:alexaverbuch,项目名称:steps,代码行数:11,代码来源:StepsExpander.java


示例10: expand

import org.neo4j.graphdb.traversal.BranchState; //导入依赖的package包/类
@Override
public Iterable<Relationship> expand(Path path, BranchState<Void> state) {
  return path.endNode().getRelationships(direction);
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:5,代码来源:DirectionalPathExpander.java


示例11: evaluate

import org.neo4j.graphdb.traversal.BranchState; //导入依赖的package包/类
@Override
public Evaluation evaluate( Path path, BranchState<StepState> state )
{
    int currentStep = state.getState().step();
    int stepStateState = state.getState().state();
    while ( true )
    {
        StepEvaluationResult result = stepEvaluators[currentStep].evaluate( path, stepStateState );
        switch ( result.stepEvaluation() )
        {
        case REJECT_STAY_EXCLUDE_PRUNE:
            /*
             * evaluator failed fatally
             */
            return Evaluation.EXCLUDE_AND_PRUNE;
        case REJECT_ADVANCE_EXCLUDE_CONTINUE:
            /*
             * evaluator failed & exhausted
             * advance evaluator immediately (current step) & retry
             */
            currentStep++;
            stepStateState = result.stepState();
            continue;
        case ACCEPT_ADVANCE_EXCLUDE_CONTINUE:
            /*
             * evaluator succeeded & exhausted
             * advance evaluator for next step
             */
            currentStep++;
            state.setState( new StepState( currentStep, result.stepState() ) );
            return Evaluation.EXCLUDE_AND_CONTINUE;
        case ACCEPT_STAY_EXCLUDE_CONTINUE:
            /*
             * evaluator succeeded but not exhausted
             * reuse evaluator @ next step
             */
            state.setState( new StepState( currentStep, result.stepState() ) );
            return Evaluation.EXCLUDE_AND_CONTINUE;
        case ACCEPT_STAY_INCLUDE_CONTINUE:
            /*
             * final evaluator succeeded but not exhausted
             * return path & reuse evaluator @ next step
             */
            state.setState( new StepState( currentStep, result.stepState() ) );
            return Evaluation.INCLUDE_AND_CONTINUE;
        case ACCEPT_ADVANCE_INCLUDE_PRUNE:
            /*
             * final evaluator succeeded & exhausted
             * return path
             */
            return Evaluation.INCLUDE_AND_PRUNE;
        }
    }
}
 
开发者ID:alexaverbuch,项目名称:steps,代码行数:55,代码来源:StepsEvaluator.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java PersistentBase类代码示例发布时间:2022-05-22
下一篇:
Java BitSet类代码示例发布时间: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