package username.bst; /** * Nodes for a binary search tree. * * @version 1.2 of April 2006 * @author Samuel A. Rebelsky */ class BSTNode { // +------------------+---------------------------------------- // | Design Decisions | // +------------------+ /* (1) BSTNode objects are intended solely for implementing binary search trees. Hence, we assume that the wrapper class (BST) accesses the fields directly, and provide neither setters nor getters. */ // +--------+-------------------------------------------------- // | Fields | // +--------+ /** * The key */ K key; /** * The value */ V value; /** * The left subtree. */ BSTNode left; /** * The right subtree. */ BSTNode right; // +--------------+-------------------------------------------- // | Constructors | // +--------------+ /** * Create a new leaf with key _key and value _value. */ public BSTNode(K _key, V _value) { this.key = _key; this.value = _value; } // BST() } // class BSTNode