#include <stdlib.h>

#ifndef TREENODE_H
#define TREENODE_H 1

class TreeNode {    
public:
        // constructors
        TreeNode() 
        {
                this->left = this->right = NULL;
        };
    	TreeNode( char character, int frequency ) 
        { 
                this->character = character; 
                this->frequency = frequency;
                this->left = this->right = NULL;
        };
    	
    	char getCharacter() { return this->character; };

    	int getFrequency() { return this->frequency; };
    	void setFrequency(int frequency) 
        { 
           this->frequency = frequency; 
        };
    
    	TreeNode* getLeft() { return left; };
    	void setLeft(TreeNode *left) { this->left = left; };

    	TreeNode *getRight() { return right; };
    	void setRight(TreeNode *right) { this->right = right; };

    	
    	bool isLeaf( )
    	{
    	     if( this->left == NULL && this->right == NULL ) 
                return true;
    	     return false;
    	}
private:
    	char character;
    	int frequency;
    	TreeNode *left;
    	TreeNode *right;
};
#endif

