本文整理汇总了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;
}
示例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;
}
示例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);
//.........这里部分代码省略.........
示例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;
}