Example #1
0
            /// <summary>
            ///
            /// </summary>
            /// <returns></returns>
            public bool MoveNext()
            {
                if (this._version != this._q._version)
                {
                    throw new ArgumentException();
                }

                if (this._index == -2)
                {
                    return(false);
                }

                ++this._index;
                if (this._index == this._q._size)
                {
                    this._index          = -2;
                    this._currentElement = default(RangeValuePair <T>);
                    return(false);
                }
                else
                {
                    this._currentElement = new RangeValuePair <T>(this._q.GetRange(this._index), this._q.GetValue(this._index));
                    return(true);
                }
            }
Example #2
0
 internal ColorsQueueEnumerator(ColorsQueue <T> q)
 {
     this._q              = q;
     this._version        = this._q._version;
     this._index          = -1;
     this._currentElement = default(RangeValuePair <T>);
 }
Example #3
0
            void IEnumerator.Reset()
            {
                if (this._version != this._q._version)
                {
                    throw new ArgumentException();
                }

                this._index          = -1;
                this._currentElement = default(RangeValuePair <T>);
            }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public RangeValuePair <T> Dequeue()
        {
            if (this._size == 0)
            {
                throw new ArgumentException();
            }

            var obj = new RangeValuePair <T>(this.GetRange(0), this.GetValue(0));

            this._keys[this._head]   = default(IRange);
            this._values[this._head] = default(T);
            this._head = (this._head + 1) % this._keys.Length;
            --this._size;
            ++this._version;
            this._offset = this._keys[this._head].Low;

            return(obj);
        }
Example #5
0
 /// <summary>
 ///
 /// </summary>
 public void Dispose()
 {
     this._index          = -2;
     this._currentElement = default(RangeValuePair <T>);
 }