<commit_before>
#ifndef TREE_NODE_H
#define TREE_NODE_H

#include <iostream>
#include <memory>
#include <utility>
using namespace std;

/**
 * A tree node class.
 * Author: <NAME>
 */
template <class T>
class tree_node {
    private:
        T key; /**< key. */
        tree_node<T>* parent; /**< parent. */
        unique_ptr<tree_node<T>>
            leftChild, /**< left child. */
            rightChild; /**< right child. */
    public:
        
        /**
         * Constructs a tree node with key keyP.
         * @param keyP the key
         */
        tree_node(T keyP) : key(keyP) {}
        
        /**
         * Returns the key.
         * @return the key
         */
        T getKey() { return key; }
        
        /**
         * Sets the parent.
         * @param parentP the parent
         * @see getParent()
         */
        void setParent(tree_node<T>* parentP) { parent = parentP; }
        
        /**
         * Returns the parent.
         * Returns nullptr if there is no parent.
         * @return the parent or nullptr if there is no parent.
         * @see setParent()
         */
        tree_node<T>* getParent() const { return parent; }
        
        /**
         * Sets the left child.
         * @param leftChildP the left child
         * @see getLeftChild()
         * @see getRightChild()
         * @see setRightChild()
         */
        void setLeftChild(unique_ptr<tree_node<T>> leftChildP)
            { leftChild = move(leftChildP); }
        
        /**
         * Sets the right child.
         * @param rightChildP the right child
         * @see getRightChild()
         * @see getLeftChild()
         * @see setLeftChild()
         */
        void setRightChild(unique_ptr<tree_node<T>> rightChildP)
            { rightChild = move(rightChildP); }
        
        /**
         * Returns the left child.
         * Returns nullptr if there is no left child.
         * @return the left child or nullptr if there is no left child
         * @see setLeftChild()
         * @see setRightChild()
         * @see getRightChild()
         */
        unique_ptr<tree_node<T>>& getLeftChild() { return leftChild; }
        
        /**
         * Returns the right child.
         * Returns nullptr if there is no right child. 
         * @return the right child or nullptr if there is no right child
         * @see setRightChild()
         * @see setLeftChild()
         * @see getLeftChild()
         */
        unique_ptr<tree_node<T>>& getRightChild() { return rightChild; }
        
        /**
         * Prints the values of all the tree nodes in the tree rooted at the
         * tree node in in-order.
         * @see printTreePreOrder()
         * @see printTreePostOrder()<commit_msg>Add tree_node<T>::height Add tree_node<T>::setHeight() Add tree_node<T>::getHeight()<commit_after>
#ifndef TREE_NODE_H
#define TREE_NODE_H

#include <iostream>
#include <memory>
#include <utility>
using namespace std;

/**
 * A tree node class.
 * Author: <NAME>
 */
template <class T>
class tree_node {
    private:
        T key; /**< key. */
        tree_node<T>* parent; /**< parent. */
        unique_ptr<tree_node<T>>
            leftChild, /**< left child. */
            rightChild; /**< right child. */
        int height; /**< height. */
    public:
        
        /**
         * Constructs a tree node with key keyP.
         * @param keyP the key
         */
        tree_node(T keyP) : key(keyP) {}
        
        /**
         * Returns the key.
         * @return the key
         */
        T getKey() { return key; }
        
        /**
         * Sets the parent.
         * @param parentP the parent
         * @see getParent()
         */
        void setParent(tree_node<T>* parentP) { parent = parentP; }
        
        /**
         * Returns the parent.
         * Returns nullptr if there is no parent.
         * @return the parent or nullptr if there is no parent.
         * @see setParent()
         */
        tree_node<T>* getParent() const { return parent; }
        
        /**
         * Sets the left child.
         * @param leftChildP the left child
         * @see getLeftChild()
         * @see getRightChild()
         * @see setRightChild()
         */
        void setLeftChild(unique_ptr<tree_node<T>> leftChildP)
            { leftChild = move(leftChildP); }
        
        /**
         * Sets the right child.
         * @param rightChildP the right child
         * @see getRightChild()
         * @see getLeftChild()
         * @see setLeftChild()
         */
        void setRightChild(unique_ptr<tree_node<T>> rightChildP)
            { rightChild = move(rightChildP); }
        
        /**
         * Returns the left child.
         * Returns nullptr if there is no left child.
         * @return the left child or nullptr if there is no left child
         * @see setLeftChild()
         * @see setRightChild()
         * @see getRightChild()
         */
        unique_ptr<tree_node<T>>& getLeftChild() { return leftChild; }
        
        /**
         * Returns the right child.
         * Returns nullptr if there is no right child. 
         * @return the right child or nullptr if there is no right child
         * @see setRightChild()
         * @see setLeftChild()
         * @see getLeftChild()
         */
        unique_ptr<tree_node<T>>& getRightChild() { return rightChild; }
        
        /**
         * Sets the height.
         * @param heightP the height
         * @see getHeight()
         */
        void setHeight(int heightP) { height = heightP; }
        
        /**
         * Returns the height.
         * @return height
         * @see setHeight()
         */
        int getHeight() const { return height; }
        
        /**
         * Prints the values of all the tree nodes in the tree rooted at the
         * tree node in in-order.
         * @see printTreePreOrder()
         * @see printTreePostOrder()
{'fraction_non_alphanumeric': 0.10862995298858294, 'fraction_numerical': 0.0, 'mean_word_length': 1.5468148781530568, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3890956', 'n_tokens_mistral': 1672, 'n_tokens_neox': 1658, 'n_words': 503}