// Null Node // // Douglas Thrift // // $Id$ #ifndef _NullNode_hpp_ #define _NullNode_hpp_ #include "Node.hpp" template class NullNode : public Node { private: bool null; public: NullNode() : null(true) {} NullNode(const Type& value) : Node::Node(value), null(false) {} ~NullNode() {} bool contains(const Type& value, NullNode* end); }; template bool NullNode::contains(const Type& value, NullNode* end) { NullNode* another = Node::getNext() != NULL ? Node::getNext() : Node::getPrevious(); if (null && end == this) { return false; } else if (!null && value == Node::getValue()) { return true; } else return another->contains(value, end); } #endif // _NullNode_hpp_