Пример #1
0
        public Object Clone()
        {
            CustomBitArray bitArray = new CustomBitArray(m_array);

            bitArray._version = _version;
            bitArray.m_length = m_length;
            return(bitArray);
        }
Пример #2
0
 public bool IsSuperSetOf(CustomBitArray other)
 {
     for (int i = 0; i < m_array.Length; i++)
     {
         var elem      = m_array[i];
         var otherElem = other.m_array[i];
         if ((elem | otherElem) != elem)
         {
             return(false);
         }
     }
     return(true);
 }
Пример #3
0
        /*=========================================================================
        ** Allocates a new BitArray with the same length and bit values as bits.
        **
        ** Exceptions: ArgumentException if bits == null.
        ** =========================================================================*/
        public CustomBitArray(CustomBitArray bits)
        {
            if (bits == null)
            {
                throw new ArgumentNullException("bits");
            }
            //Contract.EndContractBlock();

            int arrayLength = GetArrayLength(bits.m_length, BitsPerInt32);

            m_array  = new int[arrayLength];
            m_length = bits.m_length;

            Array.Copy(bits.m_array, m_array, arrayLength);

            _version = bits._version;
        }
Пример #4
0
        /*=========================================================================
        ** Returns a reference to the current instance XORed with value.
        **
        ** Exceptions: ArgumentException if value == null or
        **             value.Length != this.Length.
        ** =========================================================================*/
        public CustomBitArray Xor(CustomBitArray value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            if (Length != value.Length)
            {
                throw new ArgumentException("Array lengths differ");
            }

            int ints = GetArrayLength(m_length, BitsPerInt32);

            for (int i = 0; i < ints; i++)
            {
                m_array[i] ^= value.m_array[i];
            }

            _version++;
            return(this);
        }
Пример #5
0
 public EntityMemberMask(EntityMemberMask clone)
 {
     Key = clone.Key;
       Entity = clone.Entity;
       Bits = new CustomBitArray(clone.Bits);
 }
Пример #6
0
        public string Key; //some name-like identifier to use in ToString() method

        #endregion Fields

        #region Constructors

        public EntityMemberMask(string key, EntityInfo entity)
        {
            Key = key;
              Entity = entity;
              Bits = new CustomBitArray(Entity.Members.Count);
        }
Пример #7
0
 internal BitArrayEnumeratorSimple(CustomBitArray bitarray)
 {
     this.bitarray = bitarray;
       this.index = -1;
       version = bitarray._version;
 }
Пример #8
0
        /*=========================================================================
          ** Returns a reference to the current instance XORed with value.
          **
          ** Exceptions: ArgumentException if value == null or
          **             value.Length != this.Length.
          =========================================================================*/
        public CustomBitArray Xor(CustomBitArray value)
        {
            if (value==null)
              throw new ArgumentNullException("value");
              if (Length != value.Length)
            throw new ArgumentException("Array lengths differ");

              int ints = GetArrayLength(m_length, BitsPerInt32);
              for (int i = 0; i < ints; i++) {
              m_array[i] ^= value.m_array[i];
              }

              _version++;
              return this;
        }
Пример #9
0
 public bool IsSuperSetOf(CustomBitArray other)
 {
     for (int i = 0; i < m_array.Length; i++) {
       var elem = m_array[i];
       var otherElem = other.m_array[i];
       if ((elem | otherElem) != elem) return false;
     }
     return true;
 }
Пример #10
0
 public bool IsSubSetOf(CustomBitArray other)
 {
     return other.IsSuperSetOf(this);
 }
Пример #11
0
 public Object Clone()
 {
     CustomBitArray bitArray = new CustomBitArray(m_array);
       bitArray._version = _version;
       bitArray.m_length = m_length;
       return bitArray;
 }
Пример #12
0
        /*=========================================================================
          ** Allocates a new BitArray with the same length and bit values as bits.
          **
          ** Exceptions: ArgumentException if bits == null.
          =========================================================================*/
        public CustomBitArray(CustomBitArray bits)
        {
            if (bits == null) {
              throw new ArgumentNullException("bits");
              }
              //Contract.EndContractBlock();

              int arrayLength = GetArrayLength(bits.m_length, BitsPerInt32);
              m_array = new int[arrayLength];
              m_length = bits.m_length;

              Array.Copy(bits.m_array, m_array, arrayLength);

              _version = bits._version;
        }
Пример #13
0
 internal BitArrayEnumeratorSimple(CustomBitArray bitarray)
 {
     this.bitarray = bitarray;
     this.index    = -1;
     version       = bitarray._version;
 }
Пример #14
0
 public bool IsSubSetOf(CustomBitArray other)
 {
     return(other.IsSuperSetOf(this));
 }
Пример #15
0
 public EntityMemberMask(EntityMemberMask clone)
 {
     Key    = clone.Key;
     Entity = clone.Entity;
     Bits   = new CustomBitArray(clone.Bits);
 }
Пример #16
0
 public EntityMemberMask(string key, EntityInfo entity)
 {
     Key    = key;
     Entity = entity;
     Bits   = new CustomBitArray(Entity.Members.Count);
 }