ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/ccscs20/DoublyLinkedList.hpp
(Generate patch)

Comparing DoublyLinkedList.hpp (file contents):
Revision 7 by Douglas Thrift, 2004-05-14T00:13:01-07:00 vs.
Revision 13 by Douglas Thrift, 2004-05-15T14:59:28-07:00

# Line 18 | Line 18 | private:
18          NullNode<Type> back;
19   public:
20          DoublyLinkedList() { front.setNext(&back); back.setPrevious(&front); }
21 <        ~DoublyLinkedList();
21 >        ~DoublyLinkedList() { while (front.getNext() != &back) front.removeNext(); }
22          void addFront(const Type& value) { front.addNext(value); }
23          void addBack(const Type& value) { back.addPrevious(value); }
24 <        bool contains(const Type& value) { return front.contains(value, &back); }
25 <        void removeFirst(const Type& value) { front.remove(value, &back); }
26 <        void removeLast(const Type& value) { back.remove(value, &front, false); }
24 >        bool contains(const Type& value);
25 >        void removeFirst(const Type& value);
26 >        void removeLast(const Type& value);
27          Iterator<Type> iterator(void) { return Iterator<Type>(&front, &back); }
28 +        void accept(Visitor<Type>* visitor);
29   };
30  
31   template<typename Type>
32 < DoublyLinkedList<Type>::~DoublyLinkedList()
32 > bool DoublyLinkedList<Type>::contains(const Type& value)
33   {
34 <        while (front.getNext() != &back) front.removeNext();
34 >        return front.contains(value, dynamic_cast<Node<Type>*>(&back), true);
35 > }
36 >
37 > template<typename Type>
38 > void DoublyLinkedList<Type>::removeFirst(const Type& value)
39 > {
40 >        front.remove(value, dynamic_cast<Node<Type>*>(&back), true);
41 > }
42 >
43 > template<typename Type>
44 > void DoublyLinkedList<Type>::removeLast(const Type& value)
45 > {
46 >        back.remove(value, dynamic_cast<Node<Type>*>(&front), false);
47 > }
48 >
49 > template<typename Type>
50 > void DoublyLinkedList<Type>::accept(Visitor<Type>* visitor)
51 > {
52 >        front.accept(visitor, dynamic_cast<Node<Type>*>(&back), true);
53   }
54  
55   #endif // _DoublyLinkedList_hpp_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines