|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.sc.ants.Thing
Top-level class for all the inhabitants of the TargetShare simulation. Agents that inherit from Thing need only implement generateAction and processInput.
Field Summary | |
(package private) Environment |
env
my pointer to the enviroment Im in. |
boolean |
fixed
true if I am being handled by user. |
double |
heading
|
(package private) java.util.Vector |
lastInput
the last input I received. |
(package private) double |
myBroadcastRange
how far can I scream |
(package private) java.awt.Color |
myColor
my color |
(package private) long |
myExpireWait
the number of miliseconds that must pass before I ignore a given observation. |
int |
myID
a unique ID given to me by the Environment. |
(package private) double |
mySensingRange
how far I can sense |
(package private) double |
mySize
my size. |
java.lang.String |
name
for printing purposes. |
(package private) boolean |
running
True if this thread should be running |
(package private) boolean |
suspended
Should this agent just wait? |
java.lang.String |
type
my type. |
double |
xLocation
where I think I am |
double |
yLocation
where I think I am |
Constructor Summary | |
Thing(int id,
Environment e,
java.lang.String n,
double x,
double y,
double h,
java.lang.String t)
Constructor. |
Method Summary | |
void |
draw(java.awt.Graphics g)
I draw myself, where I think I am. |
void |
draw(java.awt.Graphics g,
double xl,
double yl,
double heading)
I draw myself on g, using the given coordinates. |
(package private) void |
expireObservations()
Expires old observations, older than myExpireWait. |
Action |
generateAction()
This routine is meant to be redefined by the programmer. |
(package private) void |
incorporateObservations(java.util.Vector vo)
Merge vo into lastInput Observations, using agentID as the unique key. |
(package private) void |
incorporateOthersObservations(Map m)
Incorporate the observations made by (possibly) others. |
void |
processInput()
This routine is meant to be redefined by the programmer. |
void |
resume()
Tell this thing to continue executing its run() loop |
void |
run()
The main loop. |
void |
start()
the thread starts running |
void |
stop()
Tell this Thing to exit its run method |
void |
suspend()
Tell this thing to wait and to nothing in its run loop |
Methods inherited from class java.lang.Object |
|
Field Detail |
public int myID
public java.lang.String type
public java.lang.String name
Environment env
public double xLocation
public double yLocation
public double heading
java.util.Vector lastInput
public boolean fixed
java.awt.Color myColor
double mySize
double mySensingRange
double myBroadcastRange
long myExpireWait
boolean running
boolean suspended
Constructor Detail |
public Thing(int id, Environment e, java.lang.String n, double x, double y, double h, java.lang.String t)
id
- my unique ID.e
- the enviroment on which I residen
- namex
- x location on the panely
- y location on the panelh
- headingt
- typeMethod Detail |
public void stop()
public void suspend()
public void resume()
public void start()
public void processInput()
public Action generateAction()
public final void run()
public void draw(java.awt.Graphics g, double xl, double yl, double heading)
g
- the Graphics object on which to draw myself.public void draw(java.awt.Graphics g)
void expireObservations()
myExpireWait
void incorporateObservations(java.util.Vector vo)
vo
- vector of @bservationvoid incorporateOthersObservations(Map m)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |