|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Observable
net.pacbell.jfai.toh.domain.Disk
public class Disk
Disks are stacked to form a tower.
| Constructor Summary | |
|---|---|
Disk(int size,
Pin pin)
Create an instance with the given size and located at the given Pin. |
|
| Method Summary | |
|---|---|
void |
changePinTo(Pin aPin)
Move the receiver from the current pin to the given pin. |
int |
compareTo(Object o)
Interface Comparable: Compare the receiver with the argument. |
boolean |
equals(Object obj)
|
Pin |
getPin()
Gets the pin. |
int |
getSize()
Gets the size. |
int |
hashCode()
|
void |
moveTo(Pin target)
Remove the receiver from the top of the current pin and add it to the top of the specified pin. |
void |
remove()
Remove the receiver from the puzzle. |
void |
setSize(int size)
Sets the size. |
String |
toString()
|
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Disk(int size,
Pin pin)
size - Relative radiuspin - A pin| Method Detail |
|---|
public void changePinTo(Pin aPin)
Note: this does not notify observers.
aPin - A pinpublic int compareTo(Object o)
compareTo in interface Comparableo - The object to compare.
public boolean equals(Object obj)
equals in class ObjectObject.equals(java.lang.Object)public Pin getPin()
public int getSize()
public int hashCode()
hashCode in class ObjectObject.hashCode()
public void moveTo(Pin target)
throws InvalidMoveException
target - A pin
InvalidMoveException - if an invalid move is attemptedpublic void remove()
public void setSize(int size)
size - An integer between 1 and the total number of disks of the
puzzle. The smallest disk has size 1.public String toString()
toString in class ObjectObject.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||