本文整理汇总了C#中IGraphProcessingEnvironment.GetVariableValue方法的典型用法代码示例。如果您正苦于以下问题:C# IGraphProcessingEnvironment.GetVariableValue方法的具体用法?C# IGraphProcessingEnvironment.GetVariableValue怎么用?C# IGraphProcessingEnvironment.GetVariableValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGraphProcessingEnvironment
的用法示例。
在下文中一共展示了IGraphProcessingEnvironment.GetVariableValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetVariableValue
// gets the variable value, decides whether to query the graph-global or the sequence-lokal variables
public object GetVariableValue(IGraphProcessingEnvironment procEnv)
{
if(Type == "") {
return procEnv.GetVariableValue(name);
} else {
#if LOG_VARIABLE_OPERATIONS
procEnv.Recorder.Write(name + "==" + EmitHelper.ToStringAutomatic(value, procEnv.Graph) + "\n");
#endif
return value;
}
}
示例2: 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;
}
示例3: Execute
public override object Execute(IGraphProcessingEnvironment procEnv)
{
if(RuleOfMatchThis != null)
return (IMatch)procEnv.GetVariableValue("this"); // global variable "this" is filled at execution begin
else if(TypeOfGraphElementThis != null)
return (IGraphElement)procEnv.GetVariableValue("this"); // global variable "this" is filled at execution begin
else
return procEnv.Graph;
}
示例4: 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;
}
//.........这里部分代码省略.........