예제 #1
0
 private ConsEnumerable()
 {
     _node = new ConsNode <T>
     {
         State = StartNode
     };
 }
예제 #2
0
        public bool MoveNext()
        {
            if (!AdvanceToNextNode())
            {
                return(false);
            }

            if (_node.State == HasEnumeration)
            {
                _node.Enumerating(new ConsListBuilderEnumerator <ConsNode <T>, T>(_node));
            }

            if (_node.State == HasValue)
            {
                return(true);
            }

            if (_node.Enumerator.MoveNext())
            {
                var newNode = new ConsNode <T> {
                    Next = _node.Next
                };
                newNode.Enumerating(_node.Enumerator);

                _node.HasValue(_node.Enumerator.Current.Value);
                _node.Next = newNode;
                return(true);
            }

            _node.IgnoredNode();
            return(MoveNext());
        }
예제 #3
0
 private ConsEnumerable(ConsNode <T> node)
 {
     _node = new ConsNode <T>
     {
         State = StartNode,
         Next  = node
     };
 }
예제 #4
0
 internal ConsEnumerable(IEnumerable <T> enumeration)
 {
     _node = _node = new ConsNode <T>
     {
         State = StartNode,
         Next  = new ConsNode <T>
         {
             State       = HasEnumeration,
             Enumeration = enumeration
         }
     };
 }
예제 #5
0
 private ConsEnumerable(IEnumerable <T> enumeration, IEnumerable <T> head)
 {
     _node = new ConsNode <T>
     {
         State = StartNode,
         Next  = new ConsNode <T>
         {
             Enumeration = head,
             State       = HasEnumeration,
             Next        = new ConsNode <T>
             {
                 Enumeration = enumeration,
                 State       = HasEnumeration
             }
         }
     };
 }
예제 #6
0
        private bool AdvanceToNextNode()
        {
            _node = _node.Next;
            if (_node == null)
            {
                Dispose();
                return(false);
            }

            while (_node.State == IgnoredNode)
            {
                _node = _node.Next;
                if (_node == null)
                {
                    Dispose();
                    return(false);
                }
            }
            return(true);
        }
예제 #7
0
 internal ConsEnumerable(ConsNode <T> node) =>
 internal ConsListBuilderEnumerator(ConsNode <T> node) => _enumerator = node.Enumeration.GetEnumerator();
예제 #9
0
 public ConsNodeEnumerator(ConsNode <T> node) => Node = node;
예제 #10
0
 private ConsEnumerable(ConsNode <T> node) =>