Inverted Index - java coding needed

compSci
binarytree.java

/** * BinaryTree is a form of linked nodes that form a tree. * * @author tai-lan hirabayashi * * @param <E> the object value that is within each node. */ public class BinaryTree<E> { E v; BinaryTree<E> treeLeft; BinaryTree<E> treeRight; /** * BinaryTree creates a new node binaryTree which holds an object value. * It takes in the value, left and right child and holds them within the node. * @param left the left child of the node. * @param value the object the node holds * @param right the right child of the node */ BinaryTree(BinaryTree<E> left, E value, BinaryTree<E> right){ v=value; treeLeft=left; treeRight=right; } /** * getLeftChild returns the left child node. * @return the left child, a binary tree node. */ BinaryTree<E> getLeftChild(){ return treeLeft; } /** * getRightChild returns the right child node. * @return the right child,a binaryTree node. */ BinaryTree<E> getRightChild(){ return treeRight; } /** * setLeftChild, sets the left child of the current node. * @param l is the left child, a binaryTree node. */ void setLeftChild(BinaryTree<E> l){ treeLeft=l; } /** * setRightChild, sets the right child of the current node. * @param r the right child, a binaryTree node. */ void setRightChild(BinaryTree<E> r){ treeRight=r; } /** * setValue sets the value of a node. * @param object value of the node. */ void setValue(E object){ v=object; } /** * getValue returns the value held in the node. * @return the object value of the node. */ E getValue(){ return v; } /** * isLeaf checks if the node is a leaf node by checking if it has children. * @return boolean if the node is a leaf node. */ boolean isLeaf(){ if(getLeftChild()==null && getRightChild()==null){ return true; } return false; } }