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


C# IGraphProcessingEnvironment.EndOfIteration方法代码示例

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


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

示例1: ApplyImpl

 protected override bool ApplyImpl(IGraphProcessingEnvironment procEnv)
 {
     long i = 0;
     while(Seq.Apply(procEnv))
     {
         procEnv.EndOfIteration(true, this);
         Seq.ResetExecutionState();
         i++;
     }
     procEnv.EndOfIteration(false, this);
     return i >= Min;
 }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:12,代码来源:Sequence.cs

示例2: Apply

        public override bool Apply(SequenceInvocationParameterBindings sequenceInvocation,
            IGraphProcessingEnvironment procEnv)
        {
            // If this sequence definition is currently executed
            // we must copy it and use the copy in its place
            // to prevent state corruption.
            if(executionState == SequenceExecutionState.Underway)
            {
                return ApplyCopy(sequenceInvocation, procEnv);
            }

            procEnv.EnteringSequence(this);
            executionState = SequenceExecutionState.Underway;
#if LOG_SEQUENCE_EXECUTION
            procEnv.Recorder.WriteLine("Before executing sequence definition " + Id + ": " + Symbol);
#endif
            bool res = ApplyImpl(sequenceInvocation, procEnv);
#if LOG_SEQUENCE_EXECUTION
            procEnv.Recorder.WriteLine("After executing sequence definition " + Id + ": " + Symbol + " result " + res);
#endif
            executionState = res ? SequenceExecutionState.Success : SequenceExecutionState.Fail;

            procEnv.EndOfIteration(false, this);

            procEnv.ExitingSequence(this);

            ResetExecutionState(); // state is shown by call, we don't exist any more for the debugger

            return res;
        }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:30,代码来源:Sequence.cs

示例3: ApplyImplProfiling

        protected bool ApplyImplProfiling(IGraphProcessingEnvironment procEnv)
        {
            bool res = true;

            INode node = (INode)ArgExprs[0].Evaluate(procEnv);
            int depth = -1;
            EdgeType edgeType;
            NodeType nodeType;

            if(SequenceType == SequenceType.ForBoundedReachableNodes
                || SequenceType == SequenceType.ForBoundedReachableNodesViaIncoming
                || SequenceType == SequenceType.ForBoundedReachableNodesViaOutgoing
                || SequenceType == SequenceType.ForBoundedReachableEdges
                || SequenceType == SequenceType.ForBoundedReachableEdgesViaIncoming
                || SequenceType == SequenceType.ForBoundedReachableEdgesViaOutgoing)
            {
                depth = (int)ArgExprs[1].Evaluate(procEnv);
                edgeType = GetEdgeType(procEnv, ArgExprs.Count >= 3 ? ArgExprs[2] : null);
                nodeType = GetNodeType(procEnv, ArgExprs.Count >= 4 ? ArgExprs[3] : null);
            }
            else
            {
                edgeType = GetEdgeType(procEnv, ArgExprs.Count >= 2 ? ArgExprs[1] : null);
                nodeType = GetNodeType(procEnv, ArgExprs.Count >= 3 ? ArgExprs[2] : null);
            }

            switch(SequenceType)
            {
                case SequenceType.ForAdjacentNodes:
                {
                    bool first = true;
                    foreach(IEdge edge in node.Incident)
                    {
                        ++procEnv.PerformanceInfo.SearchSteps;
                        if(!edge.InstanceOf(edgeType))
                            continue;
                        if(!edge.Opposite(node).InstanceOf(nodeType))
                            continue;

                        if(!first) procEnv.EndOfIteration(true, this);
                        Var.SetVariableValue(edge.Opposite(node), procEnv);
                        Seq.ResetExecutionState();
                        res &= Seq.Apply(procEnv);
                        first = false;
                    }
                    break;
                }
                case SequenceType.ForAdjacentNodesViaIncoming:
                {
                    bool first = true;
                    foreach(IEdge edge in node.Incoming)
                    {
                        ++procEnv.PerformanceInfo.SearchSteps;
                        if(!edge.InstanceOf(edgeType))
                            continue;
                        if(!edge.Source.InstanceOf(nodeType))
                            continue;

                        if(!first) procEnv.EndOfIteration(true, this);
                        Var.SetVariableValue(edge.Source, procEnv);
                        Seq.ResetExecutionState();
                        res &= Seq.Apply(procEnv);
                        first = false;
                    }
                    break;
                }
                case SequenceType.ForAdjacentNodesViaOutgoing:
                {
                    bool first = true;
                    foreach(IEdge edge in node.Outgoing)
                    {
                        ++procEnv.PerformanceInfo.SearchSteps;
                        if(!edge.InstanceOf(edgeType))
                            continue;
                        if(!edge.Target.InstanceOf(nodeType))
                            continue;

                        if(!first) procEnv.EndOfIteration(true, this);
                        Var.SetVariableValue(edge.Target, procEnv);
                        Seq.ResetExecutionState();
                        res &= Seq.Apply(procEnv);
                        first = false;
                    }
                    break;
                }
                case SequenceType.ForIncidentEdges:
                {
                    bool first = true;
                    foreach(IEdge edge in node.Incident)
                    {
                        ++procEnv.PerformanceInfo.SearchSteps;
                        if(!edge.InstanceOf(edgeType))
                            continue;
                        if(!edge.Opposite(node).InstanceOf(nodeType))
                            continue;

                        if(!first) procEnv.EndOfIteration(true, this);
                        Var.SetVariableValue(edge, procEnv);
                        Seq.ResetExecutionState();
                        res &= Seq.Apply(procEnv);
//.........这里部分代码省略.........
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:101,代码来源:Sequence.cs

示例4: ApplyImplNodesEdgesProfiling

        protected bool ApplyImplNodesEdgesProfiling(IGraphProcessingEnvironment procEnv)
        {
            bool res = true;

            switch(SequenceType)
            {
                case SequenceType.ForNodes:
                {
                    NodeType nodeType = GetNodeType(procEnv, ArgExprs.Count >= 1 ? ArgExprs[0] : null);
                    bool first = true;
                    foreach(INode node in procEnv.Graph.GetCompatibleNodes(nodeType))
                    {
                        ++procEnv.PerformanceInfo.SearchSteps;
                        if(!first) procEnv.EndOfIteration(true, this);
                        Var.SetVariableValue(node, procEnv);
                        Seq.ResetExecutionState();
                        res &= Seq.Apply(procEnv);
                        first = false;
                    }
                    break;
                }
                case SequenceType.ForEdges:
                {
                    EdgeType edgeType = GetEdgeType(procEnv, ArgExprs.Count >= 1 ? ArgExprs[0] : null);
                    bool first = true;
                    foreach(IEdge edge in procEnv.Graph.GetCompatibleEdges(edgeType))
                    {
                        ++procEnv.PerformanceInfo.SearchSteps;
                        if(!first) procEnv.EndOfIteration(true, this);
                        Var.SetVariableValue(edge, procEnv);
                        Seq.ResetExecutionState();
                        res &= Seq.Apply(procEnv);
                        first = false;
                    }
                    break;
                }
            }

            procEnv.EndOfIteration(false, this);
            return res;
        }
开发者ID:jblomer,项目名称:GrGen.NET,代码行数:41,代码来源:Sequence.cs


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