|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--edu.brook.ascape.model.AscapeObject
|
+--edu.brook.ascape.model.Agent
The base class for all modeled objects in ascape.
Note that an ascape agent is actually a superset of the general
understanding of a software 'agent'. Ascape agents need not be
mobile or autonomous, but are always capable of being so.
For instance, a lattice cell is a subclass of this class and within its
own lattice has no opportunity to move, obviously. The same cell, however,
may move upon some other lattice or collection of agents.
To represent agent state simply provide member variables along with
getters and setters in subclasses, and create StatCollectors to make aggregate values available.
To provide behavior add rules to the parent scape. A simple way to do this is to
override the scapeCreated method. There are a number of rules that
act simply to call a cooresponding method or methods in Agent. For instance,
METABOLISM_RULE will call the metabolism method on
the appropriate agents
.
ITERATE_RULE is added to the parent scape by default, and calls the
iterate method, but it is typically preferrable to use more granular
and flexible rules. To get rid of this iterate rule, overide scapeCreated, or
call clearRules on the parent scape. You should do this whenever
agent level processing is not required for a given scape; it can take time to iterate
through some scapes, and there is no way for the engine to determine at runtime that
an iterate method is a non-op.
| Field Summary | |
static Rule |
DEATH_RULE
A rule calling the death method of the target agent. |
protected boolean |
deleteMarker
A marker for deleting this agent during a later sweep. |
static Rule |
FISSIONING_RULE
A rule calling the fissioning method of the target agent. |
static Rule |
FORCE_DIE_RULE
A rule calling the die method of the target agent. |
static Rule |
FORCE_FISSION_RULE
A rule calling the fission method of the target agent. |
static Rule |
FORCE_MOVE_RULE
An rule calling the move method of the target agent, causing the agent to move regradless of what the movement condition method returns. |
static Rule |
INITIALIZE_RULE
A rule causing the target and all its children scapes to be initialized. |
boolean |
initialized
Has the agent had the initialization method performed on it since new model state? |
static Rule |
ITERATE_AND_UPDATE_RULE
A rule calling the iterate method on each agent in a scape and then the update method on each agent in a seperate, subsequent step. |
static Rule |
ITERATE_RULE
An rule calling the iterate method of the target agent. |
static Rule |
METABOLISM_RULE
An rule calling the metabolism method of the target agent. |
static Rule |
MOVEMENT_RULE
An rule calling the default movement method of the target agent. |
static Rule |
UPDATE_RULE
A rule calling the update method of the target agent. |
| Fields inherited from class edu.brook.ascape.model.AscapeObject |
ARBITRARY_SEED,
count,
name,
scape |
| Constructor Summary | |
Agent()
|
|
| Method Summary | |
java.lang.Object |
clone()
Clones the agent. |
void |
death()
Perform the death rule; if the death condition is met, kill the agent. |
boolean |
deathCondition()
Conditions under which this agent should die. |
void |
die()
Kill the agent. |
void |
execute(Rule rule)
Causes the provided rule to be executed upon this agent. |
void |
execute(Rule[] rules)
Causes the provided rules to be executed upon this agent. |
void |
fission()
Override to reproduce agent, creating a new agent. |
boolean |
fissionCondition()
Conditions under which this agent should fission. |
void |
fissioning()
Perform the fissioning rule; if the fission condition is met, fission. |
java.awt.Color |
getColor()
This agent's default color, used by many simple views. |
java.awt.Color |
getColor(java.lang.Object object)
Provides the default color for an agent. |
java.awt.Image |
getImage()
This agent's default color, used by many simple views. |
java.awt.Image |
getImage(java.lang.Object object)
Provides the default color for an agent. |
int |
getIteration()
Returns the current count of iteration. |
Scape |
getModel()
Returns the model for this scape. |
Scape |
getRoot()
Gets the rootmost parent scape for this agent. |
void |
initialize()
Initialize any values. |
boolean |
isDelete()
Is this agent marked for deletion?. |
boolean |
isInitialized()
Has this agent been initialized? |
void |
iterate()
Iterate this agent. |
void |
markForDeletion()
Sets the agent to be deleted when the next deletion sweep occurs. |
void |
metabolism()
Performs default metabolism for this agent. |
void |
move()
Override to move this agent. |
void |
movement()
Perform the movement rule; if the movement condition is met, move. |
boolean |
movementCondition()
Conditions under which this agent should move. |
void |
play(Agent agent)
Interact in some way with the supplied agent. |
void |
scapeCreated()
Notifies the prototype agent that a new scape has been created, allowing rules to be added directly from an agent class. |
java.lang.String |
toString()
A string representation of this agent. |
void |
update()
Update this agent. |
| Methods inherited from class edu.brook.ascape.model.AscapeObject |
getName,
getRandom,
getRandomSeed,
getScape,
randomInRange,
randomInRange,
randomIs,
randomToLimit,
reseed,
setName,
setRandom,
setRandomSeed,
setScape |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static final Rule INITIALIZE_RULE
public static final Rule UPDATE_RULE
public static final Rule ITERATE_AND_UPDATE_RULE
public static final Rule DEATH_RULE
public static final Rule FORCE_DIE_RULE
public static final Rule FISSIONING_RULE
public static final Rule FORCE_FISSION_RULE
public static final Rule METABOLISM_RULE
public static final Rule MOVEMENT_RULE
public static final Rule FORCE_MOVE_RULE
public static final Rule ITERATE_RULE
protected boolean deleteMarker
public boolean initialized
| Constructor Detail |
public Agent()
| Method Detail |
public void scapeCreated()
public boolean deathCondition()
DefaultDeathpublic void death()
DefaultDeath#executepublic void die()
public boolean fissionCondition()
DefaultDeathpublic void fissioning()
DefaultFissioning#executepublic void fission()
public boolean movementCondition()
DefaultMovepublic void movement()
DefaultMovement#execute()public void move()
public void metabolism()
DefaultMetabolism#executepublic void play(Agent agent)
PlayNeighbors#executepublic void iterate()
scapeCreated,
DefaultIterate#executepublic void update()
addRules,
DefaultUpdate#executepublic void initialize()
public void execute(Rule[] rules)
rules - an array of rules to be executedpublic void execute(Rule rule)
rule - a rule to be executedpublic Scape getRoot()
public Scape getModel()
getRoot,
since the root scape is typically where global paramaters are kept. At some
point this may be optimized so that the recursive lookup doesn't
have to happen at model execution time.public int getIteration()
public java.awt.Color getColor()
public java.awt.Color getColor(java.lang.Object object)
public java.awt.Image getImage()
public java.awt.Image getImage(java.lang.Object object)
public void markForDeletion()
public boolean isInitialized()
public boolean isDelete()
public java.lang.String toString()
public java.lang.Object clone()
|
(c) 1998-2000 The Brookings Insitution Webpage |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||