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