/* This file contains the code for class EmptyNode which represents the empty state of a 2-3-4 tree. EmptyNode is an example of the Null object pattern. Since there is conceptually only one empty state for all the 2-3-4 trees, EmptyNode is implemented with the Singleton pattern. 6/25/97 Copyright 1997, Dung X. Nguyen - All Rights Reserved. */ class EmptyNode extends ANode234 { final public static EmptyNode Singleton = new EmptyNode (); final boolean isEmpty () { return true; } final Integer rootData () { return null; } final void insert (Tree234 parent, Integer n) { Node2 aNode2 = new Node2 (n); parent.changeRoot (aNode2); } final void insertHelper (Tree234 grandPo, Tree234 parent, Integer n) { insert (parent, n); } final void attach (Tree234 parent, Tree234 lTree, Integer n, Tree234 rTree) { //do nothing- should never be called. } final void drawRootAndSubtrees (int level) { System.out.print ("{}"); } }