edu.brook.ascape.model
Class ScapeArray2D

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
Direct Known Subclasses:
ScapeArray2DEuclidian, ScapeArray2DMoore, ScapeArray2DVonNeumann

public abstract class ScapeArray2D
extends ScapeGraph

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.

Since:
1.0
Version:
1.5
See Also:
Serialized Form

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.Scape
AGENT_ORDER, agentsPerIteration, ALL_AGENTS, autoCreate, cellsRequestUpdates, COLLECT_STATS_RULE, collectStats, COMPLETE_TOUR, copyrightAndCredits, CREATE_RULE, CREATE_SCAPE_RULE, dataGroup, demoModelClasses, demoModelNames, description, drawFeatureObservable, drawFeatures, earliestPeriod, executionOrder, executionStyle, geometry, home, INITIAL_RULES_RULE, initialRules, INTERNAL_START_RULE, ITERATE_SCAPE_RULE, iteration, latestPeriod, membersActive, PAUSE_RULE, paused, period, periodName, prototypeAgent, REPEATED_DRAW, restartAfterAutoStop, RESUME_RULE, RULE_ORDER, rules, running, scapeListeners, selfView, standardOutView, START_RULE, startOnOpen, startPeriod, step, STOP_RULE, stopPeriod, updatedListeners, updatedMembers, version
 
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.Scape
addDrawFeature, addInitialRule, addInitialRule, addRule, addRule, addScapeListener, addStatCollector, addStatCollectors, addView, addView, addView, addViews, addViews, addViews, clone, close, closeAndOpenNew, closeAndOpenNewFinally, closeFinally, contentsToString, createOrder, createSelfView, createViews, execute, execute, executeOnMembers, executeOnMembers, executeOnMembers, executeOnRoot, executeOnRoot, exit, getAgentsNear, getAgentsPerIteration, getAllScapes, getCollectStats, getCustomizer, getData, getDescription, getDrawFeatures, getDrawFeaturesObservable, getExecutionOrder, getExecutionStyle, getGeometry, getHome, getInitialRules, getIteration, getName, getPeriod, getPeriodDescription, getPeriodName, getPrototypeAgent, getRoot, getRules, getStandardOutView, getStartPeriod, getStatCollectors, getStopPeriod, isAllViewsUpdated, isAutoCreate, isCellsRequestUpdates, isMembersActive, isMutable, isPaused, isRoot, isRunning, isStartOnOpen, isValidPeriod, isViewSelf, iterateScape, listenerOrMemberUpdated, listenerUpdated, main, memberUpdated, notifyViews, onSetup, onStart, onStop, onUpdate, open, open, open, open, open, parseSettingArgs, pause, quit, quitFinally, randomizeOrder, removeScapeListener, requestRestart, respondControl, restart, resume, retrieveAllAccessors, retrieveAllAccessorsOrdered, run, save, save, save, setAgentsPerIteration, setAutoCreate, setAutoRestart, setCellsRequestUpdates, setCollectStats, setCollectStats, setCustomizer, setDescription, setEarliestPeriod, setExecutionOrder, setExecutionStyle, setHome, setInternalPaused, setInternalRunning, setLatestPeriod, setMembersActive, setPaused, setPeriodName, setPrototypeAgent, setRunning, setStartOnOpen, setStartPeriod, setStopPeriod, setViewSelf, start, stop, toString, waitForViewsUpdate
 
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

cells

protected Cell[][] cells
The actual 2D array of agents.

agents

protected Cell[] agents
A one dimensional selection of agents. Only created if getAgents is called.

MAX_RANK

public static int MAX_RANK

relativeCoordinatesTemplate

protected static final int[][][] relativeCoordinatesTemplate

relativeCoordinates

protected int[][][] relativeCoordinates

relativeCoordinatesRankLengths

protected static int[] relativeCoordinatesRankLengths

relativeCoordinatesRankDistance

protected static double[] relativeCoordinatesRankDistance

sumOfCoordinatesWithinRank

protected static int[] sumOfCoordinatesWithinRank

rankLimit

public static int rankLimit

currentRank

protected int currentRank
The current distance from the origin for this enumeration.

currentPositionInRank

protected int currentPositionInRank
The current position within the current rank for this enumeration.
Constructor Detail

ScapeArray2D

public ScapeArray2D()
Constructs a two-dimensional scape array.

ScapeArray2D

public 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.
Parameters:
name - a descriptive name for the scape
prototypeAgent - the agent whose clones will be used to populate this scape
extent - a coordinate describing the size of this scape
Method Detail

initialize

public void initialize()
Initializes the scape, copying a set of relative coordinates for use.
Overrides:
initialize in class Scape

getNumOfCoordinatesWithinRank

protected static int getNumOfCoordinatesWithinRank(int rank)
Returns the number of relative coordiantes that exist in the given distance rank.
Parameters:
rank - the rank to return coordinate count for

randomizeRank

protected void randomizeRank(int rank)
Randomizes the coordinates within the specified rank.
Parameters:
rank - the rank to shuffle

findFirstMatchInRank

public 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. Special Note: uses euclidian, _not_ geometry specific distance; this will be fixed soon.
Parameters:
origin - the agent to find cells near
condition - the condition that found cell must meet
rank - the rank to return match in

findNearestMatchRank

public 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. Special Note: uses euclidian, _not_ geometry specific distance; this will be fixed soon.
Parameters:
origin - the agent to find cells near
condition - the condition that found cell must meet
includeOrigin - should supplied agent (rank 0) be included in the search

findNearestMatchRank

public 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. Special Note: uses euclidian, _not_ geometry specific distance; this will be fixed soon.
Parameters:
origin - the agent to find cells near
condition - the condition that found cell must meet
includeOrigin - should supplied agent (rank 0) be included in the search
maximumDistance - the maximum distance to search within

findRandomMatchInRank

public 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. Special Note: uses euclidian, _not_ geometry specific distance; this will be fixed soon.
Parameters:
origin - the agent to find cells near
condition - the condition that found cell must meet
rank - the rank to return match in

findNearestCell

public Cell findNearestCell(Cell origin,
                            Conditional condition)
Finds the nearest cell that meets some condition. Special Note: uses euclidian, _not_ geometry specific distance; this will be fixed soon.
Parameters:
origin - the agent to find cells near
condition - the condition that found cell must meet
Overrides:
findNearestCell in class ScapeGraph

findNearestCell

public Cell findNearestCell(Cell origin,
                            Conditional condition,
                            boolean includeOrigin)
Finds the nearest cell that meets some condition. Special Note: uses euclidian, _not_ geometry specific distance; this will be fixed soon.
Parameters:
origin - the agent to find cells near
condition - the condition that found cell must meet
includeOrigin - should supplied agent be included in the search
Overrides:
findNearestCell in class ScapeGraph

findNearestCell

public Cell findNearestCell(Cell origin,
                            Conditional condition,
                            boolean includeOrigin,
                            double maximumDistance)
Finds the nearest cell that meets some condition. Special Note: uses euclidian, _not_ geometry specific distance; this will be fixed soon.
Parameters:
origin - the agent to find cells near
condition - the condition that found cell must meet
includeOrigin - should supplied agent be included in the search
maximumDistance - the maximum distance to search within
Overrides:
findNearestCell in class ScapeGraph

hasWithin

public 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. Special Note: uses euclidian, _not_ geometry specific distance; this will be fixed soon.
Parameters:
origin - the agent to find cells near
condition - the condition that found cell must meet
includeOrigin - should supplied agent be included in the search
maximumDistance - the distance to search within
Overrides:
hasWithin in class ScapeGraph

countWithin

public int countWithin(Cell origin,
                       Conditional condition,
                       boolean includeOrigin,
                       double maximumDistance)
Returns the number of cells within the supplied distance that meet the supplied condition. Special Note: uses euclidian, _not_ geometry specific distance; this will be fixed soon.
Parameters:
origin - the agent to find cells near
condition - the condition that found cell must meet
includeOrigin - should supplied agent be included in the search
maximumDistance - the distance to search within
Overrides:
countWithin in class ScapeGraph

setGeometry

public void setGeometry(Geometry geometry)
Sets the geometry of this scape. Must of course be a one-dimensional geometry.
Parameters:
gometry - the basic geometry of this scape
Overrides:
setGeometry in class Scape

setExtent

public void setExtent(CoordinateDiscrete extent)
Sets the size of the scape. The extent defines the limit of the lattice (exclusive) from the origin (inclusive), so that the extent also represents the size of the lattice. It is an error to set extent while a scape is running.
Parameters:
extent - a coordinate at the maximum extent
Overrides:
setExtent in class ScapeGraph

setExtent

public void setExtent(int xSize,
                      int ySize)
Sets the size of the scape. The extent defines the limit of the lattice (exclusive) from the origin (inclusive), so that the extent also represents the size of the lattice. It is an error to set extent while a scape is running.
Parameters:
xSize - the horizontal size (width) of the scape
ySize - the vertical size (width) of the scape

createScape

public void createScape()
Populate the scape with instances of its protoype agent. Creates cells and fills them with clones of prototype agent. Geometry, extent, and prototype agent should all be set before calling this method.
Overrides:
createScape in class Scape

randomizeCallingOrder

public void randomizeCallingOrder()
Randomizes the lookup used to determine calling order for random order execution of rules.

iterator

public ScapeIterator iterator()
Overrides:
iterator in class Scape

randomIterator

public ScapeIterator randomIterator()
Overrides:
randomIterator in class Scape

getSize

public int getSize()
Returns the size, or number of cells, (the product of all extents) of this two-dimensional array.
Overrides:
getSize in class ScapeGraph

getXSize

public int getXSize()
Returns the horizontal span of the array.

getYSize

public int getYSize()
Returns the vertical span of the array.

findCells

public Cell[] findCells(Conditional condition)
Finds cells within the scape that meet some condition.
Parameters:
condition - the condition that found cell must meet
Overrides:
findCells in class ScapeGraph

findCells

public Cell[] findCells(Conditional condition,
                        int _x,
                        int _y,
                        int width,
                        int height)
Finds cells within the specified space that meet some condition.
Parameters:
condition - the condition that found cell must meet
x - the leftmost cell location
y - the topmost cell location
width - the number of vertical cells
height - the number of horizontal cells

findRandomCell

public Cell findRandomCell()
Returns a cell randomly selected from the lattice.
Overrides:
findRandomCell in class ScapeGraph

findRandomCell

public Cell findRandomCell(int x,
                           int y,
                           int width,
                           int height)
Returns a random unoccupied discrete location in the space given with the lattice.
Parameters:
x - the leftmost cell location
y - the top cell location
width - the number of vertical cells
height - the number of horizontal cells

findRandomCell

public 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.
Parameters:
Cell - a cell to exclude from search (typically origin)
x - the leftmost cell location
y - the top cell location
width - the number of vertical cells
height - the number of horizontal cells

findRandomUnoccupiedCell

public Cell findRandomUnoccupiedCell(int x,
                                     int y,
                                     int width,
                                     int height)
Returns a random unoccupied discrete location in the space given with the lattice. Returns null if no random locations are available, but an unoccupied location, even if only one exists. This method first tries testing random locations within the grid, and the first n (10) are found to be unnoccupied, the number of random locations is assumed to be sparse, and a search of all random locations is done.
Parameters:
x - the leftmost cell location
y - the top cell location
width - the number of vertical cells
height - the number of horizontal cells

findRandomCoordinate

public CoordinateDiscrete findRandomCoordinate()
Returns a coordinate randomly selected from the lattice's space.
Overrides:
findRandomCoordinate in class ScapeGraph

isValid

public boolean isValid(CoordinateDiscrete coordinate)
Determines whether the supplied coordinate is valid in the space.
Parameters:
coordinate - the position to check

getCell

public Cell getCell(CoordinateDiscrete coordinate)
Returns the cell existing at the specified coordinate. It is the programmers responisibility to determine wheteher the coordinate is valid. If in doubt, check first, otherwise a RuntimeException wil result.
Parameters:
coordinate - a coordinate asserted to be within the scape
Overrides:
getCell in class ScapeGraph
See Also:
isValid(edu.brook.ascape.model.CoordinateDiscrete)

setCell

public void setCell(CoordinateDiscrete coordinate,
                    Cell cell)
Sets the cell existing at the specified coordinate. It is the programmers responisibility to determine whether the coordinate is valid. If in doubt, check first to prevent a RuntimeException.
Parameters:
coordinate - a coordinate asserted to be within the scape
cell - the cell to place a t the specified coordinate
Overrides:
setCell in class ScapeGraph

setCell

public void setCell(int xPosition,
                    int yPosition,
                    Cell cell)
Sets the cell existing at the specified coordinate. It is the programmers responisibility to determine whether the coordinate is valid. If in doubt, check first to prevent a RuntimeException.

getCells

public Cell[] getCells()
Returns all agents in the scape as an array of cells (use this method to avoid coercion of members to Cell.)
Overrides:
getCells in class ScapeGraph

getAgents

public Agent[] getAgents()
Returns all agents in the scape as an array.
Overrides:
getAgents in class Scape

isValid

public boolean isValid(int xPosition,
                       int yPosition)
Determines whether the supplied position is valid in the space. It is the programmers responisibility to determine whether the coordinate is valid. If in doubt, check first to prevent a RuntimeException.
Parameters:
xPosition - the x position to check
yPosition - the y position to check

getCell

public Cell getCell(int xPosition,
                    int yPosition)
Returns the cell existing at the specified coordinate.

getXSpan

protected final int getXSpan(Cell origin,
                             Cell target)

getYSpan

protected final int getYSpan(Cell origin,
                             Cell target)

getCellsNear

public abstract Cell[] getCellsNear(Cell centralAgent,
                                    int distance,
                                    boolean includeSelf)
Returns cells that are near the provided cell.
Parameters:
centralAgent - the agent to find cells near
distance - the distance to form centralCells to return cells
should - supplied agent be included in the return set
Overrides:
getCellsNear in class ScapeGraph

getCellsNearMoore

public final Cell[] getCellsNearMoore(Cell centralAgent,
                                      int distance,
                                      boolean includeSelf)
Effeciently returns cells that are near the provided cell in Moore space.
Parameters:
centralAgent - the agent to find cells near
distance - the distance to form centralCells to return cells
should - supplied agent be included in the return set

getCellsNearVonNeumann

public final Cell[] getCellsNearVonNeumann(Cell centralAgent,
                                           int distance,
                                           boolean includeSelf)
Effeciently returns cells that are near the provided cell in von Neumann space. Note: uses this interpretation of von Neumann nearness, ala Sugarscape. For distance = 2, the neighhborhood would look like: N N NNTNN N N Not: N NNN NNTNN NNN N
Parameters:
centralAgent - the agent to find cells near
distance - the distance to form centralCells to return cells
should - supplied agent be included in the return set

getCellsNearEuclidian

public final Cell[] getCellsNearEuclidian(Cell centralAgent,
                                          int distance,
                                          boolean includeSelf)
Effeciently returns cells that are near the provided cell in Euclidian space. Important Note: Does not yet allow for non-periodic space.
Parameters:
centralAgent - the agent to find cells near
distance - the distance to form centralCells to return cells
should - supplied agent be included in the return set

test

public static boolean test()

(c) 1998-2000 The Brookings Insitution
Webpage