/** * Node.java * * This should be the only file you need to change for assignment 4. * */ public class Node extends AbstractNode { /** * This is the standard constructor for BTree Nodes. The actual constructor * is implemented in the parent class. * * You should not need to change this method. * * @param _isLeaf True if the node is a leaf node, and thus has no children. */ Node(boolean _isLeaf, AbstractNode _parent) { super(_isLeaf,_parent); } /** * This method is a copy constructor, used for making copies of BTrees. * * You should not change this method. * * @param _otherNode The BTree node to be copied. */ Node(AbstractNode _otherNode) { this(false,_otherNode.parent); for(int i = 0; i < maxNumKeys; i++) keys[i] = _otherNode.keys[i]; // if it's not a leaf, copy all children if (_otherNode.children != null) { children = new Node[maxNumKeys + 1]; for(int j = 0; j < maxNumKeys + 1; j++) if(_otherNode.children[j] == null) children[j] = null; else { children[j] = new Node(_otherNode.children[j]); children[j].parent = this; } } else children = null; } /** * This is an implementation of AbstractNode.search. * * You must implement this method. * * @param i The integer key to search for * @return a boolean value indicating whether or not the key was found */ boolean search(int i) { return(false); } /** * This is an implementation of AbstractNode.insert. It is a * recursive method, called on the root of tree, and then called * on each appropriate subnode until the leaf is found * * You must implement this method. You may not change the * signature of this method. You may add another method for * implementing a recursive insert, if you need a different method * signature. * * @param i The integer key to insert into the BTree. If the key is already * present, then do nothing. */ void insert(int i) { } /** * This is an implementation of AbstractNode.delete. * * You must implement this method. You may not change the * signature of this method. You may add another method for * implementing a recursive insert, if you need a different method * signature. * * @param key The integer key to insert into the BTree. If the * key is already present, then do nothing. */ void delete(int key) { } }