예제 #1
0
 public Varset And(Varset varset)
 {
     Varset cp = new Varset(this);
     cp.AlignLength(varset);
     cp.item.And(varset.item);
     return cp;
 }
예제 #2
0
 public Varset Add(Varset varset)
 {
     Varset cp = new Varset(this);
     Varset zero = new Varset(0);
     cp.AlignLength(varset);
     while (!varset.Equals(zero))
     {
         Varset tmp = cp.And(varset).LeftShift(1);
         cp = cp.Xor(varset);
         varset = tmp;
     }
     return cp;
 }
예제 #3
0
        public bool LessThan(Varset varset)
        {
            Varset cp = new Varset(this);
            Varset cp2 = new Varset(varset);
            cp.AlignLength(cp2);

            for (int i = cp.item.Length - 1; i >= 0; i--)
            {
                if (cp.item[i] && !cp2.item[i])
                {
                    return false;
                }
                else if (!cp.item[i] && cp2.item[i])
                {
                    return true;
                }
            }

            return false;
        }
예제 #4
0
        public bool Equals(Varset varset)
        {
            Varset cp = new Varset(this);
            Varset cp2 = new Varset(varset);
            cp.AlignLength(cp2);

            for (int i = 0; i < cp.item.Length; i++)
            {
                if (cp.item[i] != cp2.item[i])
                {
                    return false;
                }
            }
            return true;
        }