Exemple #1
0
 public RTSList()
 {
     _items            = _emptyArray;
     mOnItemModify     = OnItemModify;
     mOnListItemModify = OnListItemModify;
     mOnDictItemModify = OnDictItemModify;
 }
Exemple #2
0
 public RTSDict(IDictionary <string, T> dictionary, IEqualityComparer <string> comparer) : this(dictionary?.Count ?? 0, comparer)
 {
     if (dictionary == null)
     {
         throw new ArgumentNullException("dictionary");
     }
     foreach (KeyValuePair <string, T> item in dictionary)
     {
         Add(item.Key, item.Value);
     }
     mOnItemModify     = OnItemModify;
     mOnListItemModify = OnListItemModify;
     mOnDictItemModify = OnDictItemModify;
 }
Exemple #3
0
 public RTSDict(int capacity, IEqualityComparer <string> comparer)
 {
     if (capacity < 0)
     {
         throw new ArgumentOutOfRangeException("capacity");
     }
     if (capacity > 0)
     {
         Initialize(capacity);
     }
     this.comparer     = (comparer ?? EqualityComparer <string> .Default);
     mOnItemModify     = OnItemModify;
     mOnListItemModify = OnListItemModify;
     mOnDictItemModify = OnDictItemModify;
 }
Exemple #4
0
 public RTSList(int capacity)
 {
     if (capacity < 0)
     {
         throw new ArgumentOutOfRangeException("capacity");
     }
     if (capacity == 0)
     {
         _items = _emptyArray;
     }
     else
     {
         _items = new Node[capacity];
     }
     mOnItemModify     = OnItemModify;
     mOnListItemModify = OnListItemModify;
     mOnDictItemModify = OnDictItemModify;
 }
Exemple #5
0
        public RTSList(IEnumerable <T> collection)
        {
            if (collection == null)
            {
                throw new ArgumentNullException("collection");
            }
            ICollection <T> collection2 = collection as ICollection <T>;

            if (collection2 != null)
            {
                int count = collection2.Count;
                if (count == 0)
                {
                    _items = _emptyArray;
                    return;
                }
                _items = new Node[count];
                int i = 0;
                foreach (T item in collection2)
                {
                    _items[i++] = new Node(i, item, 0);
                }
                _size = count;
            }
            else
            {
                _size  = 0;
                _items = _emptyArray;
                foreach (T item in collection)
                {
                    Add(item);
                }
            }
            mOnItemModify     = OnItemModify;
            mOnListItemModify = OnListItemModify;
            mOnDictItemModify = OnDictItemModify;
        }