JML

org.jmlspecs.samples.stacks
Class BoundedStack

java.lang.Object
  extended byorg.jmlspecs.samples.stacks.BoundedStack
All Implemented Interfaces:
BoundedStackInterface, BoundedThing

public class BoundedStack
extends Object
implements BoundedStackInterface


Field Summary
protected  int maxSize
           
protected  int nextFree
           
protected  Object[] theItems
           
 
Constructor Summary
BoundedStack()
           
BoundedStack(int maxSize)
           
 
Method Summary
 Object clone()
           
 int getSizeLimit()
           
 boolean isEmpty()
           
 boolean isFull()
           
 void pop()
           
protected  void printStack()
           
 void push(Object x)
           
 Object top()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

theItems

protected Object[] theItems

nextFree

protected int nextFree

maxSize

protected int maxSize
Constructor Detail

BoundedStack

public BoundedStack()

BoundedStack

public BoundedStack(int maxSize)
Method Detail

clone

public Object clone()
Specified by:
clone in interface BoundedThing
Overrides:
clone in class Object

getSizeLimit

public int getSizeLimit()
Specified by:
getSizeLimit in interface BoundedThing

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface BoundedThing

isFull

public boolean isFull()
Specified by:
isFull in interface BoundedThing

pop

public void pop()
         throws BoundedStackException
Specified by:
pop in interface BoundedStackInterface
Throws:
BoundedStackException

push

public void push(Object x)
          throws BoundedStackException
Specified by:
push in interface BoundedStackInterface
Throws:
BoundedStackException

top

public Object top()
           throws BoundedStackException
Specified by:
top in interface BoundedStackInterface
Throws:
BoundedStackException

toString

public String toString()
Overrides:
toString in class Object

printStack

protected void printStack()

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.