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

Comparing NullNode.hpp (file contents):
Revision 1 by Douglas Thrift, 2004-05-12T23:36:53-07:00 vs.
Revision 13 by Douglas Thrift, 2004-05-15T14:59:28-07:00

# Line 9 | Line 9
9  
10   #include "Node.hpp"
11  
12 < template <typename Type>
12 > template<typename Type>
13   class NullNode : public Node<Type>
14   {
15 private:
16        bool null;
17        NullNode<Type>* next;
18        NullNode<Type>* previous;
15   public:
16 <        NullNode() : null(false) {}
17 <        NullNode(const Type& value) : Node<Type>::Node(value), null(false) {}
18 <        ~NullNode() {}
16 >        void setNext(NullNode<Type>* next) { this->next = dynamic_cast<Node<Type>*>(next); }
17 >        void setPrevious(NullNode<Type>* previous) { this->previous = dynamic_cast<Node<Type>*>(previous); }
18 >        bool contains(const Type& value, Node<Type>* end, bool forward);
19 >        void remove(const Type& value, Node<Type>* end, bool forward);
20 >        void accept(Visitor<Type>* visitor, Node<Type>* end, bool forward);
21   };
22  
23 + template<typename Type>
24 + bool NullNode<Type>::contains(const Type& value, Node<Type>* end, bool forward)
25 + {
26 +        Node<Type>* another = forward ? Node<Type>::next : Node<Type>::previous;
27 +
28 +        if (end == this) return false; else return another->contains(value, end, forward);
29 + }
30 +
31 + template<typename Type>
32 + void NullNode<Type>::remove(const Type& value, Node<Type>* end, bool forward)
33 + {
34 +        Node<Type>* another = forward ? Node<Type>::next : Node<Type>::previous;
35 +
36 +        if (end != this) another->remove(value, end, forward);
37 + }
38 +
39 + template<typename Type>
40 + void NullNode<Type>::accept(Visitor<Type>* visitor, Node<Type>* end, bool forward)
41 + {
42 +        Node<Type>* another = forward ? Node<Type>::next : Node<Type>::previous;
43 +
44 +        if (end != this) another->accept(visitor, end, forward);
45 + }
46 +
47   #endif // _NullNode_hpp_

Comparing NullNode.hpp (property svn:eol-style):
Revision 1 by Douglas Thrift, 2004-05-12T23:36:53-07:00 vs.
Revision 13 by Douglas Thrift, 2004-05-15T14:59:28-07:00

# Line 0 | Line 1
1 + native

Comparing NullNode.hpp (property svn:keywords):
Revision 1 by Douglas Thrift, 2004-05-12T23:36:53-07:00 vs.
Revision 13 by Douglas Thrift, 2004-05-15T14:59:28-07:00

# Line 0 | Line 1
1 + Id

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines