Example #1
0
            /// <summary>
            /// Advances enumeration to the next element.
            /// </summary>
            /// <returns>A value indicating whether there is another element in the enumeration.</returns>
            public bool MoveNext()
            {
                this.ThrowIfDisposed();

                if (_stack != null)
                {
                    var stack = _stack.Use(ref this);
                    if (stack.Count > 0)
                    {
                        SortedInt32KeyNode <TValue> n = stack.Pop().Value;
                        _current = n;
                        this.PushLeft(n.Right !);
                        return(true);
                    }
                }

                _current = null;
                return(false);
            }
            /// <summary>
            /// Advances enumeration to the next element.
            /// </summary>
            /// <returns>A value indicating whether there is another element in the enumeration.</returns>
            public bool MoveNext()
            {
                this.ThrowIfDisposed();
                this.ThrowIfChanged();

                var stack = _stack.Use(ref this);

                if (stack.Count > 0)
                {
                    Node n = stack.Pop().Value;
                    _current = n;
                    this.PushNext(_reverse ? n.Left : n.Right);
                    return(true);
                }
                else
                {
                    _current = null;
                    return(false);
                }
            }
            /// <summary>
            /// Advances enumeration to the next element.
            /// </summary>
            /// <returns>A value indicating whether there is another element in the enumeration.</returns>
            public bool MoveNext()
            {
                this.ThrowIfDisposed();
                this.ThrowIfChanged();

                if (_stack != null)
                {
                    var stack = _stack.Use(ref this);
                    if (stack.Count > 0)
                    {
                        Node n = stack.Pop().Value;
                        _current = n;
                        this.PushLeft(n.Right);
                        return(true);
                    }
                }

                _current = null;
                return(false);
            }
Example #4
0
            /// <summary>
            /// Advances enumeration to the next element.
            /// </summary>
            /// <returns>A value indicating whether there is another element in the enumeration.</returns>
            public bool MoveNext()
            {
                this.ThrowIfDisposed();
                this.ThrowIfChanged();

                if (_stack != null)
                {
                    var stack = _stack.Use(ref this);
                    if (_remainingCount > 0 && stack.Count > 0)
                    {
                        Node n = stack.Pop().Value;
                        _current = n;
                        this.PushNext(this.NextBranch(n));
                        _remainingCount--;
                        return(true);
                    }
                }

                _current = null;
                return(false);
            }