本文整理汇总了C#中Name.GetTerms方法的典型用法代码示例。如果您正苦于以下问题:C# Name.GetTerms方法的具体用法?C# Name.GetTerms怎么用?C# Name.GetTerms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Name
的用法示例。
在下文中一共展示了Name.GetTerms方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTerms
public static IEnumerable<Pair<Name, Name>> GetTerms(Name n1, Name n2, bool allowPartial)
{
if (!(allowPartial || n1.NumberOfTerms == n2.NumberOfTerms))
return null;
return n1.GetTerms().Zip(n2.GetTerms(), Tuples.Create);
}
示例2: PartialUnify
/// <summary>
/// Unifying Method similar to Unify but with an important difference. If one of the unifying names
/// is smaller or bigger than the other, this method considers that the names can still be partially unifiable.
///
/// The regular Unify method will always return false in such situations.
/// </summary>
/// <see cref="FAtiMA.Core.WellFormedNames.Substitution"/>
/// <see cref="FAtiMA.Core.WellFormedNames.Name"/>
/// <param name="name1">The first Name</param>
/// <param name="name2">The second Name</param>
/// <param name="bindings">The out paramenter for the founded substitutions</param>
/// <returns>True if the names are unifiable, in this case the bindings list will contain the found Substitutions, otherwise it will be empty</returns>
public static bool PartialUnify(Name name1, Name name2, out IEnumerable<Substitution> bindings)
{
bindings = null;
if (name1 == null || name2 == null)
return false;
if (name1.IsGrounded && name2.IsGrounded)
{
var it1 = name1.GetTerms().GetEnumerator();
var it2 = name2.GetTerms().GetEnumerator();
while (it1.MoveNext() && it2.MoveNext())
{
if (!it1.Current.Equals(it2.Current))
return false;
}
return true;
}
bindings = FindSubst(name1, name2,true);
return bindings != null;
}