/// <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); } }
internal ColorsQueueEnumerator(ColorsQueue <T> q) { this._q = q; this._version = this._q._version; this._index = -1; this._currentElement = default(RangeValuePair <T>); }
void IEnumerator.Reset() { if (this._version != this._q._version) { throw new ArgumentException(); } this._index = -1; this._currentElement = default(RangeValuePair <T>); }
/// <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); }
/// <summary> /// /// </summary> public void Dispose() { this._index = -2; this._currentElement = default(RangeValuePair <T>); }