|
Aquarium Lab Series | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--AquaFish
Aquarium Lab Series: The AquaFish class defines a fish in an aquarium.
Aquarium
,
AquaPoint
Constructor Summary | |
AquaFish(Aquarium aqua)
The AquaFish constructor sets properties of the AquaFish. |
|
AquaFish(Aquarium aqua,
java.awt.Color color)
The AquaFish constructor sets properties of the AquaFish. |
Method Summary | |
boolean |
atWall()
Determine whether the fish is at a wall. |
void |
changeDir()
Reverse direction. |
java.awt.Color |
color()
Get fish's color. |
int |
id()
Get the unique identifier for this fish. |
void |
moveForward()
Move forward horizontally by random increments, staying within the aquarium. |
AquaPoint |
position()
Get the fish's position in the aquarium. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AquaFish(Aquarium aqua)
aqua
- the Aquarium in which to place the fishpublic AquaFish(Aquarium aqua, java.awt.Color color)
aqua
- the Aquarium in which to place the fishcolor
- the Color to associate with the fishMethod Detail |
public int id()
public java.awt.Color color()
public AquaPoint position()
public boolean atWall()
public void moveForward()
public void changeDir()
|
Aquarium Lab Series | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |