// Null Node // // Douglas Thrift // // $Id$ #ifndef _NullNode_hpp_ #define _NullNode_hpp_ #include "Node.hpp" template class NullNode : public Node { public: void setNext(NullNode* next) { this->next = dynamic_cast*>(next); } void setPrevious(NullNode* previous) { this->previous = dynamic_cast*>(previous); } bool contains(const Type& value, Node* end, bool forward); void remove(const Type& value, Node* end, bool forward); void accept(Visitor* visitor, Node* end, bool forward); }; template bool NullNode::contains(const Type& value, Node* end, bool forward) { Node* another = forward ? Node::next : Node::previous; if (end == this) return false; else return another->contains(value, end, forward); } template void NullNode::remove(const Type& value, Node* end, bool forward) { Node* another = forward ? Node::next : Node::previous; if (end != this) another->remove(value, end, forward); } template void NullNode::accept(Visitor* visitor, Node* end, bool forward) { Node* another = forward ? Node::next : Node::previous; if (end != this) another->accept(visitor, end, forward); } #endif // _NullNode_hpp_