예제 #1
0
        public void Remove(T Data)
        {
            if (Head.Data.Equals(Data))
            {
                Head.Next.Previous = Head.Previous;
                Head.Previous.Next = Head.Next;
                Head = Head.Next;
                return;
            }

            var current = Head.Next;

            for (int i = 0; i < count; i++)
            {
                if (current.Data.Equals(Data))
                {
                    current.Next.Previous = current.Previous;
                    current.Previous.Next = current.Next;
                    count--;
                    return;
                }

                current = current.Next;
            }
        }
 private void SetHeadItem(T data)
 {
     Head          = new DuplexItem <T>(data);
     Head.Next     = Head;
     Head.Previous = Head;
     Count         = 1;
 }
예제 #3
0
 private void RemoveItem(DuplexItem <T> current)
 {
     current.Next.Previous = current.Previous;
     current.Previous.Next = current.Next;
     Count--;
     return;
 }
예제 #4
0
        public DuplexLinkedList(T data)
        {
            var item = new DuplexItem <T>(data);

            Head  = item;
            Tail  = item;
            Count = 1;
        }
예제 #5
0
        public void setDefault(T Data)
        {
            DuplexItem <T> item = new DuplexItem <T>(Data);

            Head  = item;
            Tail  = item;
            count = 1;
        }
예제 #6
0
        private void Set(T data)
        {
            var item = new DuplexItem <T>(data);

            Head  = item;
            Tail  = item;
            Count = 1;
            return;
        }
예제 #7
0
        public void setDefault(T Data)
        {
            var item = new DuplexItem <T>(Data);

            Head          = item;
            Head.Next     = Head;
            Head.Previous = Head;
            count         = 1;
        }
예제 #8
0
        public void Add(T Data)
        {
            if (count == 0)
            {
                setDefault(Data);
                return;
            }

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

            Tail.Next     = item;
            item.Previous = Tail;
            Tail          = item;
            count++;
        }
예제 #9
0
        public void Add(T Data)
        {
            if (count == 0)
            {
                setDefault(Data);
                return;
            }
            var item = new DuplexItem <T>(Data);

            item.Next          = Head;
            item.Previous      = Head.Previous;
            Head.Previous.Next = item;
            Head.Previous      = item;
            count++;
        }
예제 #10
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++;
        }
예제 #11
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++;
        }
예제 #12
0
 public void Add(T data)
 {
     if (Count != 0)
     {
         var item = new DuplexItem <T>(data);
         Tail.Next     = item;
         item.Previous = Tail;
         Tail          = item;
         Count++;
         return;
     }
     else
     {
         Set(data);
         return;
     }
 }
예제 #13
0
 private void RemoveItem(DuplexItem <T> current)
 {
     current.Next.Previos = current.Previos;
     current.Previos.Next = current.Next;
     Count--;
 }