Esempio n. 1
0
        /// <summary>
        /// Returns the LUB of the two kinds in the kind lattice
        /// </summary>
        public static CommonNoun LeastUpperBound(CommonNoun a, CommonNoun b)
        {
            if (a == null)
            {
                return(b);
            }
            if (b == null)
            {
                return(a);
            }

            if (a.IsSuperKindOf(b))
            {
                return(a);
            }

            foreach (var super in a.Superkinds)
            {
                var lub = LeastUpperBound(super, b);
                if (lub != null)
                {
                    return(lub);
                }
            }

            return(null);
        }
Esempio n. 2
0
 /// <summary>
 /// This is a subkind of the specified superkind
 /// </summary>
 public bool IsSubKindOf(CommonNoun super) => super.IsSuperKindOf(this);