edu.brook.ascape.rule
Class MoveRandomWithin
java.lang.Object
|
+--edu.brook.ascape.model.AscapeObject
|
+--edu.brook.ascape.rule.Rule
|
+--edu.brook.ascape.rule.MoveRandomWithin
- public class MoveRandomWithin
- extends Rule
A rule causing the taget agent to move to a random location within some bounded area.
- Since:
- 1.0
- Version:
- 1.0
- See Also:
- Serialized Form
|
Constructor Summary |
MoveRandomWithin()
Constructs a new move random within rule, with no area defined. |
MoveRandomWithin(int x,
int y,
int width,
int height)
Constructs a new move random within rule, causing the agenst to move to a random
location within the area defined. |
|
Method Summary |
void |
execute(Agent agent)
Move to a random location in the lattice. |
boolean |
isCauseRemoval()
Returns false. |
void |
setArea(int x,
int y,
int width,
int height)
The agent must select its new location from within this area. |
| Methods inherited from class edu.brook.ascape.model.AscapeObject |
clone,
getName,
getRandom,
getRandomSeed,
randomInRange,
randomInRange,
randomIs,
randomToLimit,
reseed,
setName,
setRandom,
setRandomSeed,
toString |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
MoveRandomWithin
public MoveRandomWithin()
- Constructs a new move random within rule, with no area defined.
MoveRandomWithin
public MoveRandomWithin(int x,
int y,
int width,
int height)
- Constructs a new move random within rule, causing the agenst to move to a random
location within the area defined.
- Parameters:
x - top boundary of the areay - left boundary of the areawidth - horizontal extent of areaheight - vertical extent of area
setArea
public void setArea(int x,
int y,
int width,
int height)
- The agent must select its new location from within this area.
- Parameters:
x - top boundary of the areay - left boundary of the areawidth - horizontal extent of areaheight - vertical extent of area
execute
public void execute(Agent agent)
- Move to a random location in the lattice.
- Parameters:
agent - the playing agent- Overrides:
- execute in class Rule
- See Also:
CellOccupant#moveTo()
isCauseRemoval
public boolean isCauseRemoval()
- Returns false. Movement should not usually cause agent removal.
- Overrides:
- isCauseRemoval in class Rule