package dataStructures; import java.io.Serializable; class BSTNode implements Serializable { static final long serialVersionUID = 0L; // Entry stored in the node. private EntryClass entry; // (Pointer to) the left child. private BSTNode leftChild; // (Pointer to) the right child. private BSTNode rightChild; public BSTNode( K key, V value, BSTNode left, BSTNode right ) { entry = new EntryClass(key, value); leftChild = left; rightChild = right; } public BSTNode( K key, V value ) { this(key, value, null, null); } public EntryClass getEntry( ) { return entry; } public K getKey( ) { return entry.getKey(); } public V getValue( ) { return entry.getValue(); } public BSTNode getLeft( ) { return leftChild; } public BSTNode getRight( ) { return rightChild; } public void setEntry( EntryClass newEntry ) { entry = newEntry; } public void setEntry( K newKey, V newValue ) { entry.setKey(newKey); entry.setValue(newValue); } public void setKey( K newKey ) { entry.setKey(newKey); } public void setValue( V newValue ) { entry.setValue(newValue); } public void setLeft( BSTNode newLeft ) { leftChild = newLeft; } public void setRight( BSTNode newRight ) { rightChild = newRight; } // Returns true iff the node is a leaf. public boolean isLeaf( ) { return leftChild == null && rightChild == null; } }