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


C# Name.GetTerms方法代码示例

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

示例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;
        }
开发者ID:GAIPS-INESC-ID,项目名称:FAtiMA-Toolkit,代码行数:33,代码来源:Unifier.cs


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