Beispiel #1
0
 private void SetHeadItem(T data)
 {
     Head          = new DuplexItem <T>(data);
     Head.Next     = Head;
     Head.Previous = Head;
     Count         = 1;
 }
Beispiel #2
0
        public DuplexLinkedList(T data)
        {
            var item = new DuplexItem <T>(data);

            Head  = item;
            Tail  = item;
            Count = 1;
        }
Beispiel #3
0
        public void Add(T data)
        {
            if (Count == 0)
            {
                SetHeadItem(data);
                return;
            }

            var item = new DuplexItem <T>(data);

            item.Next          = Head;
            item.Previous      = Head.Previous;
            Head.Previous.Next = item;
            Head.Previous      = item;
            Count++;
        }
Beispiel #4
0
        public void Add(T data)
        {
            var item = new DuplexItem <T>(data);

            if (Count == 0)
            {
                Head  = item;
                Tail  = item;
                Count = 1;
                return;
            }

            Tail.Next     = item;
            item.Previous = Tail;
            Tail          = item;
            Count++;
        }
Beispiel #5
0
 private void RemoveItem(DuplexItem <T> current)
 {
     current.Next.Previous = current.Previous;
     current.Previous.Next = current.Next;
     Count--;
 }