// Node.h - word consists of a Pair // left is pointing to left child of Node // right is pointing to right child of Node #ifndef NODE_CLASS #define NODE_CLASS #include "Pair.h" class Node { private: Pair word; Node *left; Node *right; public: // default constructor // initializes all data members to default values Node(); // constructor with Pair p // other data members are set to default values Node(Pair p); // constructor with data members set to // p, l and r, respectively Node(Pair p, Node *l, Node *r); // accessor for Pair // returns the Pair // need to define it this way in order to use iterators const Pair & getPair() const; // accessor for pair // non-const version of getPair() Pair & getPair(); // returns pointer to the node "left" points to Node * getLeft(); // returns pointer to the node "right" points to Node * getRight(); // mutator - changes value of left to x void setLeft(Node * x); // mutator - changes value of right to y void setRight(Node * y); // mutator - changes the value of word void setPair(Pair p); // for the purpose of testing Node class // writes the contents of a single Node // writes the following: text = codeword // writes the following: code = numbers // where "codeword" and "numbers" are replaced // by actual values in the node // calls writer methods from Pair.cpp void writer(); private: // you may put any other private methods here }; #endif // NODE_CLASS