Example #1
0
 private ConsEnumerable()
 {
     _node = new ConsNode <T>
     {
         State = StartNode
     };
 }
Example #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());
        }
Example #3
0
 private ConsEnumerable(ConsNode <T> node)
 {
     _node = new ConsNode <T>
     {
         State = StartNode,
         Next  = node
     };
 }
Example #4
0
 internal ConsEnumerable(IEnumerable <T> enumeration)
 {
     _node = _node = new ConsNode <T>
     {
         State = StartNode,
         Next  = new ConsNode <T>
         {
             State       = HasEnumeration,
             Enumeration = enumeration
         }
     };
 }
Example #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
             }
         }
     };
 }
Example #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);
        }
Example #7
0
 internal ConsEnumerable(ConsNode <T> node) =>
 internal ConsListBuilderEnumerator(ConsNode <T> node) => _enumerator = node.Enumeration.GetEnumerator();
Example #9
0
 public ConsNodeEnumerator(ConsNode <T> node) => Node = node;
Example #10
0
 private ConsEnumerable(ConsNode <T> node) =>