Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
 public bool IsSubKindOf(CommonNoun super) => super.IsSuperKindOf(this);