示例#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);
 }