本文整理汇总了C#中IGraphProcessingEnvironment.SetVariableValue方法的典型用法代码示例。如果您正苦于以下问题:C# IGraphProcessingEnvironment.SetVariableValue方法的具体用法?C# IGraphProcessingEnvironment.SetVariableValue怎么用?C# IGraphProcessingEnvironment.SetVariableValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGraphProcessingEnvironment
的用法示例。
在下文中一共展示了IGraphProcessingEnvironment.SetVariableValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: If
private bool If(IGraphElement element, IGraphProcessingEnvironment procEnv)
{
if(ifClause != null)
{
object oldThis = procEnv.GetVariableValue("this");
procEnv.SetVariableValue("this", element);
bool result = (bool)ifClause.Evaluate(procEnv);
procEnv.SetVariableValue("this", oldThis);
return result;
}
return true;
}
示例2: SetVariableValue
// sets the variable value, decides whether to update the graph-global or the sequence-lokal variables
public void SetVariableValue(object value, IGraphProcessingEnvironment procEnv)
{
if(Type == "") {
procEnv.SetVariableValue(name, value);
} else {
#if LOG_VARIABLE_OPERATIONS
procEnv.Recorder.Write(name + " = " + EmitHelper.ToStringAutomatic(value, procEnv.Graph) + "\n");
#endif
this.value = value;
}
}
示例3: Decide
public SubruleDebuggingDecision Decide(SubruleDebuggingEvent sde, object data, IGraphProcessingEnvironment procEnv)
{
if(!enabled)
return SubruleDebuggingDecision.Undefined;
if(debuggingEvent != sde)
return SubruleDebuggingDecision.Undefined;
switch(sde)
{
case SubruleDebuggingEvent.Add:
case SubruleDebuggingEvent.Rem:
case SubruleDebuggingEvent.Emit:
case SubruleDebuggingEvent.Halt:
case SubruleDebuggingEvent.Highlight:
{
string message = (string)data;
switch(messageMatchingMode)
{
case SubruleMesssageMatchingMode.Equals:
if(message == messageToMatch)
return decisionOnMatch;
break;
case SubruleMesssageMatchingMode.StartsWith:
if(message.StartsWith(messageToMatch))
return decisionOnMatch;
break;
case SubruleMesssageMatchingMode.EndsWith:
if(message.EndsWith(messageToMatch))
return decisionOnMatch;
break;
case SubruleMesssageMatchingMode.Contains:
if(message.Contains(messageToMatch))
return decisionOnMatch;
break;
default:
throw new Exception("INTERNAL FAILURE: unkonwn message matching mode");
}
}
return SubruleDebuggingDecision.Undefined;
case SubruleDebuggingEvent.Match:
{
IMatches matches = (IMatches)data;
if(matches.Producer == actionToMatch)
{
if(ifClause != null)
{
object oldThis = procEnv.GetVariableValue("this");
bool result = false;
foreach(IMatch match in matches)
{
procEnv.SetVariableValue("this", match);
if((bool)ifClause.Evaluate(procEnv))
{
result = true;
break;
}
}
procEnv.SetVariableValue("this", oldThis);
if(result)
return decisionOnMatch;
}
else
return decisionOnMatch;
}
return SubruleDebuggingDecision.Undefined;
}
case SubruleDebuggingEvent.New:
case SubruleDebuggingEvent.Delete:
case SubruleDebuggingEvent.Retype:
case SubruleDebuggingEvent.SetAttributes:
{
IGraphElement elem = (IGraphElement)data;
if(nameToMatch != null)
{
if(procEnv.NamedGraph.GetElementName(elem) == nameToMatch)
{
if(If(elem, procEnv))
return decisionOnMatch;
}
}
if(typeToMatch != null)
{
if(elem.Type is NodeType && typeToMatch is NodeType && elem.Type.IsA(typeToMatch)
|| elem.Type is EdgeType && typeToMatch is EdgeType && elem.Type.IsA(typeToMatch))
{
if(onlyThisType)
{
if(typeToMatch.IsA(elem.Type))
{
if(If(elem, procEnv))
return decisionOnMatch;
}
}
else
{
if(If(elem, procEnv))
return decisionOnMatch;
}
//.........这里部分代码省略.........