Beispiel #1
0
 /// <summary>
 ///	Creates a read-only wrapper for a <c>BoolCollection</c> instance.
 /// </summary>
 /// <returns>
 ///     An <c>BoolCollection</c> wrapper that is read-only.
 /// </returns>
 public static BoolCollection ReadOnly(BoolCollection list)
 {
     if (list == null)
     {
         throw new ArgumentNullException("list");
     }
     return(new ReadOnlyBoolCollection(list));
 }
Beispiel #2
0
 /// <summary>
 ///	Creates a synchronized (thread-safe) wrapper for a
 /// <c>BoolCollection</c> instance.
 /// </summary>
 /// <returns>
 /// An <c>BoolCollection</c> wrapper that is synchronized (thread-safe).
 /// </returns>
 public static BoolCollection Synchronized(BoolCollection list)
 {
     if (list == null)
     {
         throw new ArgumentNullException("list");
     }
     return(new SyncBoolCollection(list));
 }
Beispiel #3
0
        /// <summary>
        ///	Creates a deep copy of the <see cref="BoolCollection"/>.
        /// </summary>
        public virtual BoolCollection Clone()
        {
            BoolCollection newColl = new BoolCollection(m_count);

            Array.Copy(m_array, 0, newColl.m_array, 0, m_count);
            newColl.m_count   = m_count;
            newColl.m_version = m_version;

            return(newColl);
        }
Beispiel #4
0
        /// <summary>
        ///		Adds the elements of another <c>BoolCollection</c> to the current <c>BoolCollection</c>.
        /// </summary>
        /// <param name="x">The <c>BoolCollection</c> whose elements should be added to the end of the current <c>BoolCollection</c>.</param>
        /// <returns>The new <see cref="BoolCollection.Count"/> of the <c>BoolCollection</c>.</returns>
        public virtual int AddRange(BoolCollection x)
        {
            if (m_count + x.Count >= m_array.Length)
            {
                EnsureCapacity(m_count + x.Count);
            }

            Array.Copy(x.m_array, 0, m_array, m_count, x.Count);
            m_count += x.Count;
            m_version++;

            return(m_count);
        }
Beispiel #5
0
            public override int AddRange(BoolCollection x)
            {
                int result = 0;

                rwLock.AcquireWriterLock(timeout);

                try
                {
                    result = collection.AddRange(x);
                }
                finally
                {
                    rwLock.ReleaseWriterLock();
                }

                return(result);
            }
Beispiel #6
0
 internal ReadOnlyBoolCollection(BoolCollection list) : base(Tag.Default)
 {
     m_collection = list;
 }
Beispiel #7
0
 /// <summary>
 ///		Initializes a new instance of the <c>BoolCollection</c> class
 ///		that contains elements copied from the specified <c>BoolCollection</c>.
 /// </summary>
 /// <param name="c">The <c>BoolCollection</c> whose elements are copied to the new collection.</param>
 public BoolCollection(BoolCollection c)
 {
     m_array = new bool[c.Count];
     AddRange(c);
 }
Beispiel #8
0
 internal SyncBoolCollection(BoolCollection list) : base(Tag.Default)
 {
     rwLock     = new System.Threading.ReaderWriterLock();
     collection = list;
 }
Beispiel #9
0
 /// <summary>
 ///		Initializes a new instance of the <c>Enumerator</c> class.
 /// </summary>
 /// <param name="tc"></param>
 internal Enumerator(BoolCollection tc)
 {
     m_collection = tc;
     m_index      = -1;
     m_version    = tc.m_version;
 }
Beispiel #10
0
 public override int AddRange(BoolCollection x)
 {
     throw new NotSupportedException("This is a Read Only Collection and can not be modified");
 }