org.ascape.model.rule
Class MoveRandomWithin

java.lang.Object
  extended by org.ascape.model.AscapeObject
      extended by org.ascape.model.rule.Rule
          extended by org.ascape.model.rule.MoveRandomWithin
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HasName, RandomFunctions

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
Author:
Miles Parker
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.ascape.model.AscapeObject
ARBITRARY_SEED, name, scape
 
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 org.ascape.model.rule.Rule
getScape, isIterateAll, isRandomExecution, setScape
 
Methods inherited from class org.ascape.model.AscapeObject
clone, diffDeep, diffDeep, diffDeepBFS, diffDeepDFS, diffDeepValidate, diffDeepVisit, equalsDeep, equalsDeep, equalsDeep, getComparisonStream, getName, getRandom, getRandomSeed, randomInRange, randomInRange, randomIs, randomToLimit, reseed, setComparisonStream, setName, setRandom, setRandomSeed, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 area
y - left boundary of the area
width - horizontal extent of area
height - vertical extent of area
Method Detail

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 area
y - left boundary of the area
width - horizontal extent of area
height - vertical extent of area

execute

public void execute(Agent agent)
Move to a random location in the lattice.

Specified by:
execute in class Rule
Parameters:
agent - the playing agent
See Also:
CellOccupant.moveTo(org.ascape.model.HostCell)

isCauseRemoval

public boolean isCauseRemoval()
Returns false. Movement should not usually cause agent removal.

Overrides:
isCauseRemoval in class Rule
Returns:
true, if is cause removal


Copyright © 1998-2008 The Brookings Institution, NuTech Solutions, Metascape, LLC All Rights Reserved.