本文整理汇总了C#中Name.Match方法的典型用法代码示例。如果您正苦于以下问题:C# Name.Match方法的具体用法?C# Name.Match怎么用?C# Name.Match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Name
的用法示例。
在下文中一共展示了Name.Match方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Unify
/// <summary>
/// Unifying Method, receives two WellFormedNames and tries
/// to find a list of Substitutions that will make
/// both names syntatically equal. The algorithm performs Occur Check,
/// as such the unification of [X] and Luke([X]) will allways fail.
///
/// The method goes on each symbol (for both names) at a time, and tries to find
/// a substitution between them. Take into account that the Unification between
/// [X](John,Paul) and Friend(John,[X]) fails because the algorithm considers [X]
/// to be the same variable
/// </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 Unify(Name name1, Name name2, out IEnumerable<Substitution> bindings)
{
bindings = null;
if (name1 == null || name2 == null)
return false;
if (name1.IsGrounded && name2.IsGrounded)
{
var result = name1.Match(name2);
if (result)
bindings = Enumerable.Empty<Substitution>();
return result;
}
bindings = FindSubst(name1, name2,false);
return bindings != null;
}