コード例 #1
0
ファイル: RTSList.cs プロジェクト: thegreatclock/archive
 public RTSList()
 {
     _items            = _emptyArray;
     mOnItemModify     = OnItemModify;
     mOnListItemModify = OnListItemModify;
     mOnDictItemModify = OnDictItemModify;
 }
コード例 #2
0
ファイル: RTSDict.cs プロジェクト: thegreatclock/archive
 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;
 }
コード例 #3
0
ファイル: RTSDict.cs プロジェクト: thegreatclock/archive
 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;
 }
コード例 #4
0
ファイル: RTSList.cs プロジェクト: thegreatclock/archive
 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;
 }
コード例 #5
0
ファイル: RTSList.cs プロジェクト: thegreatclock/archive
        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;
        }