Beispiel #1
0
            /// <summary>
            /// Initializes an <see cref="Enumerator"/> structure.
            /// </summary>
            /// <param name="root">The root of the set to be enumerated.</param>
            /// <param name="builder">The builder, if applicable.</param>
            /// <param name="startIndex">The index of the first element to enumerate.</param>
            /// <param name="count">The number of elements in this collection.</param>
            /// <param name="reversed"><c>true</c> if the list should be enumerated in reverse order.</param>
            internal Enumerator(Node root, Builder builder = null, int startIndex = -1, int count = -1, bool reversed = false)
            {
                Requires.NotNull(root, nameof(root));
                Requires.Range(startIndex >= -1, nameof(startIndex));
                Requires.Range(count >= -1, nameof(count));
                Requires.Argument(reversed || count == -1 || (startIndex == -1 ? 0 : startIndex) + count <= root.Count);
                Requires.Argument(!reversed || count == -1 || (startIndex == -1 ? root.Count - 1 : startIndex) - count + 1 >= 0);

                _root    = root;
                _builder = builder;
                _current = null;
                _currentNodeEnumeratingByIndex = null;
                _startIndex                = startIndex >= 0 ? startIndex : (reversed ? root.Count - 1 : 0);
                _currentIndex              = _startIndex;
                _count                     = count == -1 ? root.Count : count;
                _remainingCount            = _count;
                _reversed                  = reversed;
                _enumeratingBuilderVersion = builder != null ? builder.Version : -1;
                _stackSlot0                = default;
                _stackSlot1                = default;
                _stackSlot2                = default;
                _stackSlot3                = default;
                _stackSlot4                = default;
                _stackSlot5                = default;
                _stackSlot6                = default;
                _stackSlot7                = default;
                _stackSlot8                = default;
                _stackSlot9                = default;
                _stackSlot10               = default;
                _stackSlot11               = default;
                _stackSlot12               = default;
                _stackSlot13               = default;
                _stackSlot14               = default;
                _stackSlot15               = default;
                _stackSlot16               = default;
                _stackSlot17               = default;
                _stackSlot18               = default;
                _stackSlot19               = default;
                _stackSlot20               = default;
                _stackSlot21               = default;
                _stackSlot22               = default;
                _stackSlot23               = default;
                _stackSlot24               = default;
                _stackSlot25               = default;
                _stackSlot26               = default;
                _stackSlot27               = default;
                _stackSlot28               = default;
                _stackSlot29               = default;
                _stackSlot30               = default;
                _stackSlot31               = default;
                _stackSlot32               = default;
                _stackSlot33               = default;
                _stackSlot34               = default;
                _stackSlot35               = default;
                _stackSlot36               = default;
                _stackSlot37               = default;
                _stackSlot38               = default;
                _stackSlot39               = default;
                _stackSlot40               = default;
                _stackSlot41               = default;
                _stackSlot42               = default;
                _stackSlot43               = default;
                _stackSlot44               = default;
                _stackSlot45               = default;
                _stackSlot46               = default;
                _stackTopIndex             = -1;
                if (_count > 0)
                {
                    this.ResetStack();
                }
            }