当前位置: 首页>>代码示例>>C#>>正文


C# Name.Match方法代码示例

本文整理汇总了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;
        }
开发者ID:GAIPS-INESC-ID,项目名称:FAtiMA-Toolkit,代码行数:34,代码来源:Unifier.cs


注:本文中的Name.Match方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。