|
|
|||||||||
| 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
|
+--edu.brook.ascape.model.Cell
|
+--edu.brook.ascape.model.CellOccupant
|
+--edu.brook.ascape.model.Scape
|
+--edu.brook.ascape.model.ScapeGraph
|
+--edu.brook.ascape.model.ScapeArray2D
A two-dimensional, fixed-size collection of agents providing services described for scape. Important: at moment, does not support von Neumann or Moore space for find near, uses Euclidian distances only.
| Field Summary | |
protected Cell[] |
agents
A one dimensional selection of agents. |
protected Cell[][] |
cells
The actual 2D array of agents. |
protected int |
currentPositionInRank
The current position within the current rank for this enumeration. |
protected int |
currentRank
The current distance from the origin for this enumeration. |
static int |
MAX_RANK
|
static int |
rankLimit
|
protected int[][][] |
relativeCoordinates
|
protected static double[] |
relativeCoordinatesRankDistance
|
protected static int[] |
relativeCoordinatesRankLengths
|
protected static int[][][] |
relativeCoordinatesTemplate
|
protected static int[] |
sumOfCoordinatesWithinRank
|
| Fields inherited from class edu.brook.ascape.model.ScapeGraph |
extent |
| Fields inherited from class edu.brook.ascape.model.CellOccupant |
MOVE_RANDOM_LOCATION_RULE,
PLAY_HOST_RULE,
PLAY_NEIGHBORS_RULE,
PLAY_OTHER,
RANDOM_WALK_AVAILABLE_RULE,
RANDOM_WALK_RULE |
| Fields inherited from class edu.brook.ascape.model.Cell |
cellsNear,
coordinate,
neighbors,
thisUpdate |
| Fields inherited from class edu.brook.ascape.model.Agent |
DEATH_RULE,
deleteMarker,
FISSIONING_RULE,
FORCE_DIE_RULE,
FORCE_FISSION_RULE,
FORCE_MOVE_RULE,
INITIALIZE_RULE,
initialized,
ITERATE_AND_UPDATE_RULE,
ITERATE_RULE,
METABOLISM_RULE,
MOVEMENT_RULE,
UPDATE_RULE |
| Fields inherited from class edu.brook.ascape.model.AscapeObject |
ARBITRARY_SEED,
count,
name,
scape |
| Constructor Summary | |
ScapeArray2D()
Constructs a two-dimensional scape array. |
|
ScapeArray2D(java.lang.String name,
Geometry geometry,
Cell prototypeAgent,
CoordinateDiscrete extent)
Constructs a two-dimensional scape array of provided geometry and extent, populated with clones of provided agent. |
|
| Method Summary | |
int |
countWithin(Cell origin,
Conditional condition,
boolean includeOrigin,
double maximumDistance)
Returns the number of cells within the supplied distance that meet the supplied condition. |
void |
createScape()
Populate the scape with instances of its protoype agent. |
Cell[] |
findCells(Conditional condition)
Finds cells within the scape that meet some condition. |
Cell[] |
findCells(Conditional condition,
int _x,
int _y,
int width,
int height)
Finds cells within the specified space that meet some condition. |
Cell |
findFirstMatchInRank(Cell origin,
Conditional condition,
int rank)
Returns the first element in the supplied rank that matches the supplied condition, null if no matches. |
Cell |
findNearestCell(Cell origin,
Conditional condition)
Finds the nearest cell that meets some condition. |
Cell |
findNearestCell(Cell origin,
Conditional condition,
boolean includeOrigin)
Finds the nearest cell that meets some condition. |
Cell |
findNearestCell(Cell origin,
Conditional condition,
boolean includeOrigin,
double maximumDistance)
Finds the nearest cell that meets some condition. |
int |
findNearestMatchRank(Cell origin,
Conditional condition,
boolean includeOrigin)
Returns the nearest rank that includes a cell which matches the supplied condition, -1 if no matches. |
int |
findNearestMatchRank(Cell origin,
Conditional condition,
boolean includeOrigin,
double maximumDistance)
Returns the nearest rank that includes a cell which matches the supplied condition, -1 if no matches. |
Cell |
findRandomCell()
Returns a cell randomly selected from the lattice. |
Cell |
findRandomCell(Cell cell,
int x,
int y,
int width,
int height)
Returns a random unoccupied discrete location in the space given with the lattice. |
Cell |
findRandomCell(int x,
int y,
int width,
int height)
Returns a random unoccupied discrete location in the space given with the lattice. |
CoordinateDiscrete |
findRandomCoordinate()
Returns a coordinate randomly selected from the lattice's space. |
Cell |
findRandomMatchInRank(Cell origin,
Conditional condition,
int rank)
Returns a random element in the supplied rank that matches the supplied condition, null if no matches. |
Cell |
findRandomUnoccupiedCell(int x,
int y,
int width,
int height)
Returns a random unoccupied discrete location in the space given with the lattice. |
Agent[] |
getAgents()
Returns all agents in the scape as an array. |
Cell |
getCell(CoordinateDiscrete coordinate)
Returns the cell existing at the specified coordinate. |
Cell |
getCell(int xPosition,
int yPosition)
Returns the cell existing at the specified coordinate. |
Cell[] |
getCells()
Returns all agents in the scape as an array of cells (use this method to avoid coercion of members to Cell.) |
abstract Cell[] |
getCellsNear(Cell centralAgent,
int distance,
boolean includeSelf)
Returns cells that are near the provided cell. |
Cell[] |
getCellsNearEuclidian(Cell centralAgent,
int distance,
boolean includeSelf)
Effeciently returns cells that are near the provided cell in Euclidian space. |
Cell[] |
getCellsNearMoore(Cell centralAgent,
int distance,
boolean includeSelf)
Effeciently returns cells that are near the provided cell in Moore space. |
Cell[] |
getCellsNearVonNeumann(Cell centralAgent,
int distance,
boolean includeSelf)
Effeciently returns cells that are near the provided cell in von Neumann space. |
protected static int |
getNumOfCoordinatesWithinRank(int rank)
Returns the number of relative coordiantes that exist in the given distance rank. |
int |
getSize()
Returns the size, or number of cells, (the product of all extents) of this two-dimensional array. |
int |
getXSize()
Returns the horizontal span of the array. |
protected int |
getXSpan(Cell origin,
Cell target)
|
int |
getYSize()
Returns the vertical span of the array. |
protected int |
getYSpan(Cell origin,
Cell target)
|
boolean |
hasWithin(Cell origin,
Conditional condition,
boolean includeOrigin,
double maximumDistance)
Returns true if there is a cell within the supplied distance that meets the supplied condition. |
void |
initialize()
Initializes the scape, copying a set of relative coordinates for use. |
boolean |
isValid(CoordinateDiscrete coordinate)
Determines whether the supplied coordinate is valid in the space. |
boolean |
isValid(int xPosition,
int yPosition)
Determines whether the supplied position is valid in the space. |
ScapeIterator |
iterator()
|
ScapeIterator |
randomIterator()
|
void |
randomizeCallingOrder()
Randomizes the lookup used to determine calling order for random order execution of rules. |
protected void |
randomizeRank(int rank)
Randomizes the coordinates within the specified rank. |
void |
setCell(CoordinateDiscrete coordinate,
Cell cell)
Sets the cell existing at the specified coordinate. |
void |
setCell(int xPosition,
int yPosition,
Cell cell)
Sets the cell existing at the specified coordinate. |
void |
setExtent(CoordinateDiscrete extent)
Sets the size of the scape. |
void |
setExtent(int xSize,
int ySize)
Sets the size of the scape. |
void |
setGeometry(Geometry geometry)
Sets the geometry of this scape. |
static boolean |
test()
|
| Methods inherited from class edu.brook.ascape.model.ScapeGraph |
executeOnMembers,
findAvailable,
findAvailable,
findCells,
findMaximumCell,
findMaximumWithin,
findOccupants,
findOccupants,
findRandomCell,
findRandomCells,
findRandomCells,
findRandomUnoccupiedCell,
findRandomUnoccupiedCell,
getDistance,
getExtent |
| Methods inherited from class edu.brook.ascape.model.CellOccupant |
die,
getAvailableNeighboringCells,
getCellsNearOnHost,
getHostCell,
getHostScape,
getNeighborsOnHost,
leave,
moveAway,
moveTo,
moveToRandomLocation,
moveToward,
randomWalk,
randomWalkAvailable,
setHostScape |
| Methods inherited from class edu.brook.ascape.model.Cell |
countNeighbors,
countWithin,
findMaximumWithin,
findNearestCell,
findNearestCell,
findNearestCell,
findRandomNeighbor,
getCellsNear,
getCoordinate,
getDistance,
getNeighbors,
getNeighbors,
getNetwork,
getOccupant,
hasWithin,
isAvailable,
isUpdateNeeded,
removeOccupant,
requestUpdate,
requestUpdateNext,
setCoordinate,
setNeighbors,
setNetwork,
setOccupant |
| Methods inherited from class edu.brook.ascape.model.Agent |
death,
deathCondition,
execute,
execute,
fission,
fissionCondition,
fissioning,
getColor,
getColor,
getImage,
getImage,
getModel,
isDelete,
isInitialized,
iterate,
markForDeletion,
metabolism,
move,
movement,
movementCondition,
play,
scapeCreated,
update |
| Methods inherited from class edu.brook.ascape.model.AscapeObject |
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 |
protected Cell[][] cells
protected Cell[] agents
public static int MAX_RANK
protected static final int[][][] relativeCoordinatesTemplate
protected int[][][] relativeCoordinates
protected static int[] relativeCoordinatesRankLengths
protected static double[] relativeCoordinatesRankDistance
protected static int[] sumOfCoordinatesWithinRank
public static int rankLimit
protected int currentRank
protected int currentPositionInRank
| Constructor Detail |
public ScapeArray2D()
public ScapeArray2D(java.lang.String name,
Geometry geometry,
Cell prototypeAgent,
CoordinateDiscrete extent)
name - a descriptive name for the scapeprototypeAgent - the agent whose clones will be used to populate this scapeextent - a coordinate describing the size of this scape| Method Detail |
public void initialize()
protected static int getNumOfCoordinatesWithinRank(int rank)
rank - the rank to return coordinate count forprotected void randomizeRank(int rank)
rank - the rank to shuffle
public Cell findFirstMatchInRank(Cell origin,
Conditional condition,
int rank)
origin - the agent to find cells nearcondition - the condition that found cell must meetrank - the rank to return match in
public int findNearestMatchRank(Cell origin,
Conditional condition,
boolean includeOrigin)
origin - the agent to find cells nearcondition - the condition that found cell must meetincludeOrigin - should supplied agent (rank 0) be included in the search
public int findNearestMatchRank(Cell origin,
Conditional condition,
boolean includeOrigin,
double maximumDistance)
origin - the agent to find cells nearcondition - the condition that found cell must meetincludeOrigin - should supplied agent (rank 0) be included in the searchmaximumDistance - the maximum distance to search within
public Cell findRandomMatchInRank(Cell origin,
Conditional condition,
int rank)
origin - the agent to find cells nearcondition - the condition that found cell must meetrank - the rank to return match in
public Cell findNearestCell(Cell origin,
Conditional condition)
origin - the agent to find cells nearcondition - the condition that found cell must meet
public Cell findNearestCell(Cell origin,
Conditional condition,
boolean includeOrigin)
origin - the agent to find cells nearcondition - the condition that found cell must meetincludeOrigin - should supplied agent be included in the search
public Cell findNearestCell(Cell origin,
Conditional condition,
boolean includeOrigin,
double maximumDistance)
origin - the agent to find cells nearcondition - the condition that found cell must meetincludeOrigin - should supplied agent be included in the searchmaximumDistance - the maximum distance to search within
public boolean hasWithin(Cell origin,
Conditional condition,
boolean includeOrigin,
double maximumDistance)
origin - the agent to find cells nearcondition - the condition that found cell must meetincludeOrigin - should supplied agent be included in the searchmaximumDistance - the distance to search within
public int countWithin(Cell origin,
Conditional condition,
boolean includeOrigin,
double maximumDistance)
origin - the agent to find cells nearcondition - the condition that found cell must meetincludeOrigin - should supplied agent be included in the searchmaximumDistance - the distance to search withinpublic void setGeometry(Geometry geometry)
gometry - the basic geometry of this scapepublic void setExtent(CoordinateDiscrete extent)
extent - a coordinate at the maximum extent
public void setExtent(int xSize,
int ySize)
xSize - the horizontal size (width) of the scapeySize - the vertical size (width) of the scapepublic void createScape()
public void randomizeCallingOrder()
public ScapeIterator iterator()
public ScapeIterator randomIterator()
public int getSize()
public int getXSize()
public int getYSize()
public Cell[] findCells(Conditional condition)
condition - the condition that found cell must meet
public Cell[] findCells(Conditional condition,
int _x,
int _y,
int width,
int height)
condition - the condition that found cell must meetx - the leftmost cell locationy - the topmost cell locationwidth - the number of vertical cellsheight - the number of horizontal cellspublic Cell findRandomCell()
public Cell findRandomCell(int x,
int y,
int width,
int height)
x - the leftmost cell locationy - the top cell locationwidth - the number of vertical cellsheight - the number of horizontal cells
public Cell findRandomCell(Cell cell,
int x,
int y,
int width,
int height)
Cell - a cell to exclude from search (typically origin)x - the leftmost cell locationy - the top cell locationwidth - the number of vertical cellsheight - the number of horizontal cells
public Cell findRandomUnoccupiedCell(int x,
int y,
int width,
int height)
x - the leftmost cell locationy - the top cell locationwidth - the number of vertical cellsheight - the number of horizontal cellspublic CoordinateDiscrete findRandomCoordinate()
public boolean isValid(CoordinateDiscrete coordinate)
coordinate - the position to checkpublic Cell getCell(CoordinateDiscrete coordinate)
coordinate - a coordinate asserted to be within the scapeisValid(edu.brook.ascape.model.CoordinateDiscrete)
public void setCell(CoordinateDiscrete coordinate,
Cell cell)
coordinate - a coordinate asserted to be within the scapecell - the cell to place a t the specified coordinate
public void setCell(int xPosition,
int yPosition,
Cell cell)
public Cell[] getCells()
public Agent[] getAgents()
public boolean isValid(int xPosition,
int yPosition)
xPosition - the x position to checkyPosition - the y position to check
public Cell getCell(int xPosition,
int yPosition)
protected final int getXSpan(Cell origin,
Cell target)
protected final int getYSpan(Cell origin,
Cell target)
public abstract Cell[] getCellsNear(Cell centralAgent,
int distance,
boolean includeSelf)
centralAgent - the agent to find cells neardistance - the distance to form centralCells to return cellsshould - supplied agent be included in the return set
public final Cell[] getCellsNearMoore(Cell centralAgent,
int distance,
boolean includeSelf)
centralAgent - the agent to find cells neardistance - the distance to form centralCells to return cellsshould - supplied agent be included in the return set
public final Cell[] getCellsNearVonNeumann(Cell centralAgent,
int distance,
boolean includeSelf)
centralAgent - the agent to find cells neardistance - the distance to form centralCells to return cellsshould - supplied agent be included in the return set
public final Cell[] getCellsNearEuclidian(Cell centralAgent,
int distance,
boolean includeSelf)
centralAgent - the agent to find cells neardistance - the distance to form centralCells to return cellsshould - supplied agent be included in the return setpublic static boolean test()
|
(c) 1998-2000 The Brookings Insitution Webpage |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||