|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uwcse.sim.OilThing
The fundamental basis for objects in the OilSpill simulation. Knows its x,y position and the world it lives in.
Field Summary | |
protected boolean |
alive
|
static java.util.Random |
rand
|
protected WorldModel |
world
|
protected int |
x
|
protected int |
y
|
Constructor Summary | |
OilThing(WorldModel wm,
int x,
int y)
Create a new OilThing with the given properties. |
Method Summary | |
abstract void |
action()
Leave this to the subclasses. |
void |
checkNeighbors()
Asks the world for the things in the same cell, and then calls interact() on each of those things. |
abstract void |
displayOn(uwcse.graphics.GWindow g)
Leave this to the subclasses. |
int |
getX()
Answer the x position. |
int |
getY()
Answer the y position. |
void |
interact(OilThing t)
Interact with another OilThing. |
boolean |
isAlive()
Answer the flag value. |
void |
kill()
Sets the alive flag to false. |
java.lang.String |
toString()
Answer the name and location. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static java.util.Random rand
protected int x
protected int y
protected WorldModel world
protected boolean alive
Constructor Detail |
public OilThing(WorldModel wm, int x, int y)
Method Detail |
public int getX()
getX
in interface Thing
public int getY()
getY
in interface Thing
public abstract void action()
action
in interface Thing
public abstract void displayOn(uwcse.graphics.GWindow g)
displayOn
in interface Thing
public boolean isAlive()
isAlive
in interface Thing
public void kill()
public void interact(OilThing t)
public void checkNeighbors()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |