Exemplo n.º 1
0
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }
            CList <T> list = (CList <T>)obj;

            if (_length != list._length)
            {
                return(false);
            }
            CNode <T> node1 = _head.Next;
            CNode <T> node2 = list._head.Next;

            while (node1 != _tail)
            {
                if (!node1.Data.Equals(node2.Data))
                {
                    return(false);
                }
                node1 = node1.Next;
                node2 = node2.Next;
            }
            return(true);
        }
Exemplo n.º 2
0
        public void Extend(CList <T> list)
        {
            CNode <T> node = list._head.Next;

            while (node != list._tail)
            {
                Append(node.Data);
                node = node.Next;
            }
        }
Exemplo n.º 3
0
        public CList(CList <T> list)
        {
            Clear();
            _head      = new CNode <T>();
            _tail      = new CNode <T>();
            _head.Next = _tail;
            CNode <T> node = list._head.Next;

            while (node != list._tail)
            {
                Append(node.Data);
                node = node.Next;
            }
        }
Exemplo n.º 4
0
 public CStack()
 {
     _list = new CList <T>();
 }
Exemplo n.º 5
0
 public CQueue()
 {
     _list = new CList <T>();
 }