|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Pile
Constructor Summary | |
Pile()
Creates a new empty pile. |
Method Summary | |
void |
addDisk(Disk disk)
adds a new disk onto the top of the pile. |
int |
getNumberOfDisks()
returns the number of disks on the pile. |
boolean |
isEmpty()
returns true if the pile is empty, false otherwise. |
Disk |
removeDisk()
removes the first disk on the pile if exists and returns it. |
Disk |
topDisk()
returns the top disk on the pile without removing it from the pile. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Pile()
Method Detail |
public final int getNumberOfDisks()
public Disk removeDisk()
public void addDisk(Disk disk)
disk
- the disk to be added onto the top of the pile.public Disk topDisk()
public boolean isEmpty()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |