Beispiel #1
0
        public ClusteredList <T> GetRange(int index, int count)
        {
            if (index < 0)
            {
                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
            }

            if (count < 0)
            {
                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
            }

            if (_size - index < count)
            {
                ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
            }
#if DEBUG
            Contract.Ensures(Contract.Result <ClusteredList <T> >() != null);
            Contract.EndContractBlock();
#endif
            ClusteredList <T> list = new ClusteredList <T>(count);
            ClusteredArray <T> .Copy(_items, index, list._items, 0, count);

            list._size = count;
            return(list);
        }
Beispiel #2
0
 internal ClusteredListEnumerator(ClusteredList <T> list)
 {
     this.list = list;
     index     = 0;
     version   = list._version;
     current   = default(T);
 }
Beispiel #3
0
        public object Clone()
        {
            ClusteredList <T> clone = new ClusteredList <T>(this.Capacity);

            clone._items   = (ClusteredArray <T>) this._items.Clone();
            clone._size    = this._size;
            clone._version = this._version;
            return(clone);
        }
Beispiel #4
0
            public bool MoveNext()
            {
                ClusteredList <T> localList = list;

                if (version == localList._version && ((uint)index < (uint)localList._size))
                {
                    current = localList._items[index];
                    index++;
                    return(true);
                }
                return(MoveNextRare());
            }
Beispiel #5
0
        public ClusteredList <TOutput> ConvertAll <TOutput>(Converter <T, TOutput> converter)
        {
            if (converter == null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.converter);
            }
            // @

#if DEBUG
            Contract.EndContractBlock();
#endif
            ClusteredList <TOutput> list = new ClusteredList <TOutput>(_size);
            for (int i = 0; i < _size; i++)
            {
                list._items[i] = converter(_items[i]);
            }
            list._size = _size;
            return(list);
        }
Beispiel #6
0
 internal ClusteredListImmutableEnumerator(ClusteredList <T> list)
 {
     _list   = (ClusteredList <T>)list.Clone();
     index   = 0;
     current = default(T);
 }
Beispiel #7
0
 internal SynchronizedClusteredList(ClusteredList <T> list)
 {
     _list = list;
     _root = ((System.Collections.ICollection)list).SyncRoot;
 }
Beispiel #8
0
 internal static IList <T> Synchronized(ClusteredList <T> list)
 {
     return(new SynchronizedClusteredList(list));
 }