// ModNode.h - word consists of a Pair // parent is pointing to parent of ModNode // left is pointing to left child of ModNode // right is pointing to right child of ModNode #ifndef MODNODE_CLASS #define MODNODE_CLASS #include "Pair.h" class ModNode { private: Pair word; ModNode *left; ModNode *right; ModNode * parent; public: // default constructor // initializes all data members to default values ModNode(); // constructor with Pair p // other data members are set to default values ModNode(Pair p); // constructor with data members set to // p, prnt (parent), l (left) and r (right), respectively ModNode(Pair p, ModNode *prnt, ModNode *l, ModNode *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 Modnode left points to ModNode * getLeft(); // returns pointer to the Modnode right points to ModNode * getRight(); // returns pointer to the Modnode parent points to ModNode * getParent(); // mutator - changes value of left to x void setLeft(ModNode * x); // mutator - changes value of right to y void setRight(ModNode * y); // mutator - changes value of parent to y void setParent(ModNode * y); // mutator - changes the value of word void setPair(Pair p); // for the purpose of testing ModNode class // writes the contents of a single ModNode // writes the following: text = codeword // writes the following: code = numbers // where "codeword" and "numbers" are replaced // by actual values in the Modnode // calls writer methods from Pair.cpp void writer(); private: // you may put any other private methods here }; #endif // MODNODE_CLASS