Example #1
0
 internal Enumerator(RTSList <T> list)
 {
     this.list = list;
     index     = 0;
     version   = list._version;
     current   = default(T);
 }
Example #2
0
            public bool MoveNext()
            {
                RTSList <T> list = this.list;

                if (version == list._version && (uint)index < (uint)list._size)
                {
                    current = list._items[index].v;
                    index++;
                    return(true);
                }
                return(MoveNextRare());
            }
Example #3
0
        public RTSList <TOutput> ConvertAll <TOutput>(Converter <T, TOutput> converter)
        {
            if (converter == null)
            {
                throw new ArgumentNullException("converter");
            }
            RTSList <TOutput> list = new RTSList <TOutput>(_size);

            for (int i = 0; i < _size; i++)
            {
                Node item = _items[i];
                list._items[i] = new RTSList <TOutput> .Node(item.p, converter(item.v), 0);
            }
            list._size = _size;
            return(list);
        }
Example #4
0
        public RTSList <T> FindAll(Predicate <T> match)
        {
            if (match == null)
            {
                throw new ArgumentNullException("match");
            }
            RTSList <T> list = new RTSList <T>();

            for (int i = 0; i < _size; i++)
            {
                if (match(_items[i].v))
                {
                    list.Add(_items[i].v);
                }
            }
            return(list);
        }
Example #5
0
        public RTSList <T> GetRange(int index, int count)
        {
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index");
            }
            if (count < 0)
            {
                throw new ArgumentOutOfRangeException("count");
            }
            if (_size - index < count)
            {
                throw new ArgumentException("Argument_InvalidOffLen");
            }
            RTSList <T> list = new RTSList <T>(count);

            Array.Copy(_items, index, list._items, 0, count);
            list._size = count;
            return(list);
        }