Пример #1
0
        public new bool Delete(Notebook value)
        {
            TwoNode current = Head;

            while (current != null)
            {
                if (current.element.Equals(value))
                {
                    break;
                }
                current = current.nextElement;
            }
            if (current != null)
            {
                if (current.nextElement != null)
                {
                    current.nextElement.element = current.element;
                }
                else
                {
                    Tail.element = current.element;
                }
                if (current.element != null)
                {
                    current.nextElement = current.nextElement;
                }
                else
                {
                    Head = current.nextElement;
                }
                Counter--;
                return(true);
            }
            return(false);
        }
Пример #2
0
        public IEnumerable BackEnumerator()
        {
            TwoNode current = Tail;

            while (current != null)
            {
                yield return(current);

                current = current.element;
            }
        }
Пример #3
0
        public IEnumerator StartEnumerator()
        {
            TwoNode current = Head;

            while (current != null)
            {
                yield return(current);

                current = current.nextElement;
            }
        }
Пример #4
0
 public new Notebook this[int index]
 {
     get
     {
         TwoNode current = Head;
         int     i       = 0;
         while (current != null && i != index)
         {
             current = current.nextElement;
             i++;
         }
         return(current.Element);
     }
 }
Пример #5
0
        public new void Add(Notebook value)
        {
            TwoNode twonode = new TwoNode(value, null);

            if (Head == null)
            {
                Head = twonode;
            }
            else
            {
                Tail.nextElement = twonode;
                TwoNode previous = Tail;
            }
            Tail = twonode;
            Counter++;
        }
Пример #6
0
        public new void AddFirst(Notebook value)
        {
            TwoNode twonode = new TwoNode(value, null);
            TwoNode Tail    = Head;

            twonode.nextElement = Tail;
            Head = twonode;
            if (Counter == 0)
            {
                Tail = Head;
            }
            else
            {
                Tail.nextElement = twonode;
            }
            Counter++;
        }