// Empty stacks. // // For purpose statements and algebraic specification, see Stack.java. class EmptyStack extends StackBase { EmptyStack () { } public Stack push (E x) { return new Push (this, x); } public boolean isEmpty () { return true; } public E top () { String msg1 = "attempted to compute the top of an empty StackInt"; throw new RuntimeException (msg1); } public Stack pop () { return this; // FIXME: this is evil } public int size () { return 0; } }