本文整理汇总了C#中Name.GetNTerm方法的典型用法代码示例。如果您正苦于以下问题:C# Name.GetNTerm方法的具体用法?C# Name.GetNTerm怎么用?C# Name.GetNTerm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Name
的用法示例。
在下文中一共展示了Name.GetNTerm方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BaseEvent
protected BaseEvent(uint id, Name eventName, ulong timestamp)
{
Id = id;
Type = eventName.GetNTerm(1);
Subject = eventName.GetNTerm(2);
Timestamp = timestamp;
EventName = eventName;
}
示例2: AssertEventNameValidity
public static void AssertEventNameValidity(Name name)
{
if (name.NumberOfTerms != 5)
throw new Exception("A event name must contain 5 terms");
if(!name.IsGrounded)
throw new Exception("A event name cannot contain variables");
if (name.GetNTerm(0) != EVT_NAME)
throw new Exception("The first term of an event name must be \"Event\"");
if (name.GetNTerm(1).IsComposed)
throw new Exception("The second term of an event name cannot be a composed name.");
if (name.GetNTerm(2).IsComposed)
throw new Exception("The third term of an event name cannot be a composed name.");
if (name.GetNTerm(4).IsComposed)
throw new Exception("The fifth term of an event name cannot be a composed name.");
}
示例3: ExtractPropertyFromToM
private Name ExtractPropertyFromToM(Name property, List<Name> ToMList, string argumentName)
{
if (property.GetFirstTerm() != TOM_NAME)
return property;
if (property.NumberOfTerms != 3)
throw new ArgumentException("The property name contains a invalid Theory of the Mind");
var pers = property.GetNTerm(1);
var prop = property.GetNTerm(2);
AssetToMList(ToMList,pers,argumentName);
return ExtractPropertyFromToM(prop, ToMList, argumentName);
}
示例4: Key2ToMList
private static IEnumerable<Name> Key2ToMList(Name key)
{
while (key.IsComposed)
{
var c = key.GetFirstTerm();
yield return c;
key = key.GetNTerm(1);
}
yield return key;
}
示例5: IsActionEvent
public static bool IsActionEvent(Name eventName)
{
var t = eventName.GetNTerm(1);
return t == Constants.ACTION_START_EVENT || t == Constants.ACTION_FINISHED_EVENT;
}
示例6: ActionEvent
public ActionEvent(uint id, Name eventName, ulong timestamp)
: base(id, eventName, timestamp)
{
Action = eventName.GetNTerm(3);
Target = eventName.GetNTerm(4);
}
示例7: IsPropertyChangeEvent
public static bool IsPropertyChangeEvent(Name eventName)
{
return eventName.GetNTerm(1) == Constants.PROPERTY_CHANGE_EVENT;
}
示例8: PropertyChangeEvent
public PropertyChangeEvent(uint id, Name eventName, ulong timestamp)
: base(id, eventName, timestamp)
{
Property = eventName.GetNTerm(3);
NewValue = eventName.GetNTerm(4);
}