示例#1
0
 private FastIDSet(FastIDSet copyFrom)
 {
     this.keys = new long[copyFrom.keys.Length];
     for (int i = 0; i < copyFrom.keys.Length; i++)
     {
         this.keys[i] = copyFrom.keys[i];
     }
     this.loadFactor   = copyFrom.loadFactor;
     this.numEntries   = copyFrom.numEntries;
     this.numSlotsUsed = copyFrom.numSlotsUsed;
 }
示例#2
0
        public override bool Equals(object other)
        {
            long num5;

            if (!(other is FastIDSet))
            {
                return(false);
            }
            FastIDSet set = (FastIDSet)other;

            long[] keys   = set.keys;
            int    length = this.keys.Length;
            int    num2   = keys.Length;
            int    num3   = Math.Min(length, num2);
            int    index  = 0;

            while (index < num3)
            {
                num5 = this.keys[index];
                long num6 = keys[index];
                if ((num5 == NULL) || (num5 == REMOVED))
                {
                    if ((num6 != NULL) && (num6 != REMOVED))
                    {
                        return(false);
                    }
                }
                else if (num5 != num6)
                {
                    return(false);
                }
                index++;
            }
            while (index < length)
            {
                num5 = this.keys[index];
                if ((num5 != NULL) && (num5 != REMOVED))
                {
                    return(false);
                }
                index++;
            }
            while (index < num2)
            {
                num5 = keys[index];
                if ((num5 != NULL) && (num5 != REMOVED))
                {
                    return(false);
                }
                index++;
            }
            return(true);
        }
示例#3
0
        public bool removeAll(FastIDSet c)
        {
            bool flag = false;

            foreach (long num in c.keys)
            {
                if (((num != NULL) && (num != REMOVED)) && this.remove(num))
                {
                    flag = true;
                }
            }
            return(flag);
        }
示例#4
0
        public int intersectionSize(FastIDSet other)
        {
            int num = 0;

            foreach (long num2 in other.keys)
            {
                if (((num2 != NULL) && (num2 != REMOVED)) && (this.keys[this.find(num2)] != NULL))
                {
                    num++;
                }
            }
            return(num);
        }
示例#5
0
        public bool retainAll(FastIDSet c)
        {
            bool flag = false;

            for (int i = 0; i < this.keys.Length; i++)
            {
                long key = this.keys[i];
                if (!(((key == NULL) || (key == REMOVED)) || c.contains(key)))
                {
                    this.keys[i] = REMOVED;
                    this.numEntries--;
                    flag = true;
                }
            }
            return(flag);
        }