示例#1
0
        public VectorDomain <T> Lub(VectorDomain <T> other)
        {
            if (Elements.Count != other.Elements.Count)
            {
                return(null);
            }
            var res = new Seq <T>(Elements.Count);

            for (var i = 0; i < Elements.Count; i++)
            {
                res.Add(Elements[i].Lub(other.Elements[i]));
            }
            return(new VectorDomain <T>(res));
        }
示例#2
0
 public bool CommutableWith(VectorDomain <T> other)
 {
     if (Elements.Count != other.Elements.Count)
     {
         throw new InvalidOperationException("incompatible domains");
     }
     for (var i = 0; i < Elements.Count; i++)
     {
         if (!Elements[i].CommutableWith(other.Elements[i]))
         {
             return(false);
         }
     }
     return(true);
 }
示例#3
0
 public bool Lte(VectorDomain <T> other)
 {
     if (Elements.Count != other.Elements.Count)
     {
         throw new InvalidOperationException("comparing vectors of unequal length");
     }
     for (var i = 0; i < Elements.Count; i++)
     {
         if (!Elements[i].Lte(other.Elements[i]))
         {
             return(false);
         }
     }
     return(true);
 }
示例#4
0
        public VectorDomain <T> Lub(VectorDomain <T> other, BoolRef changed)
        {
            if (Elements.Count != other.Elements.Count)
            {
                return(null);
            }
            var res = default(Seq <T>);

            for (var i = 0; i < Elements.Count; i++)
            {
                var thisChanged = new BoolRef();
                var elem        = Elements[i].Lub(other.Elements[i], thisChanged);
                if (elem == null)
                {
                    return(null);
                }
                if (thisChanged.Value && res == null)
                {
                    changed.Set();
                    res = new Seq <T>(Elements.Count);
                    for (var j = 0; j < i; j++)
                    {
                        res.Add(Elements[i]);
                    }
                }
                if (res != null)
                {
                    res[i] = elem;
                }
            }
            if (res == null)
            {
                return(this);
            }
            else
            {
                return(new VectorDomain <T>(res));
            }
        }