Пример #1
0
        public IEnumerator <T> GetEnumerator()
        {
            current = head;
            do
            {
                if (current != null)
                {
                    yield return(current.Data);

                    current = current.Next;
                }
            }while (current != head);
        }
Пример #2
0
 public DoublyNode <T> Current(T data)
 {
     if (head == null)
     {
         return(null);
     }
     current = head;
     do
     {
         if (current.Data.Equals(data))
         {
             return(current);
         }
         current = current.Next;
     }while (current != head);
     return(null);
 }
Пример #3
0
 public void Add(DoublyNode <T> node)
 {
     if (head == null)
     {
         head          = node;
         head.Previous = node;
         head.Next     = node;
     }
     else
     {
         node.Previous      = head.Previous;
         node.Next          = head;
         head.Previous.Next = node;
         head.Previous      = node;
     }
     count++;
 }
Пример #4
0
 public void Clear()
 {
     head  = null;
     count = 0;
 }
Пример #5
0
 public DoublyNode <T> MovePrevious()
 {
     current = current.Previous;
     return(current);
 }
Пример #6
0
 public DoublyNode <T> MoveNext()
 {
     current = current.Next;
     return(current);
 }