edu.brook.ascape.model
Class ScapeArray2DVonNeumann

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
                                            |
                                            +--edu.brook.ascape.model.ScapeArray2DVonNeumann

public class ScapeArray2DVonNeumann
extends ScapeArray2D

A two-dimensional scape providing effecient implementations for von Neumann neighbors. In a von Neumann neighborhood, cells are considered neighbors if they share an edge with the target:

                                       O
                                      OXO
                                       O   

Since:
1.0
Version:
1.5
See Also:
Serialized Form

Fields inherited from class edu.brook.ascape.model.ScapeArray2D
agents, cells, currentPositionInRank, currentRank, MAX_RANK, rankLimit, relativeCoordinates, relativeCoordinatesRankDistance, relativeCoordinatesRankLengths, relativeCoordinatesTemplate, 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
ScapeArray2DVonNeumann()
          Constructs a two-dimensional Moore array.
ScapeArray2DVonNeumann(java.lang.String name, Cell prototypeAgent, CoordinateDiscrete extent)
          Constructs a two-dimensional scape array of provided geometry and extent, populated with clones of provided agent.
 
Method Summary
 Cell[] getCellsNear(Cell centralAgent, int distance, boolean includeSelf)
          Effeciently returns cells that are near the provided cell.
 int getDistance(Cell origin, Cell target)
          Returns the shortest distance between one cell and the other, assuming a walk between the two cells.
 
Methods inherited from class edu.brook.ascape.model.ScapeArray2D
countWithin, createScape, findCells, findCells, findFirstMatchInRank, findNearestCell, findNearestCell, findNearestCell, findNearestMatchRank, findNearestMatchRank, findRandomCell, findRandomCell, findRandomCell, findRandomCoordinate, findRandomMatchInRank, findRandomUnoccupiedCell, getAgents, getCell, getCell, getCells, getCellsNearEuclidian, getCellsNearMoore, getCellsNearVonNeumann, getNumOfCoordinatesWithinRank, getSize, getXSize, getXSpan, getYSize, getYSpan, hasWithin, initialize, isValid, isValid, iterator, randomIterator, randomizeCallingOrder, randomizeRank, setCell, setCell, setExtent, setExtent, setGeometry, test
 
Methods inherited from class edu.brook.ascape.model.ScapeGraph
executeOnMembers, findAvailable, findAvailable, findCells, findMaximumCell, findMaximumWithin, findOccupants, findOccupants, findRandomCell, findRandomCells, findRandomCells, findRandomUnoccupiedCell, findRandomUnoccupiedCell, 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
 

Constructor Detail

ScapeArray2DVonNeumann

public ScapeArray2DVonNeumann()
Constructs a two-dimensional Moore array.

ScapeArray2DVonNeumann

public ScapeArray2DVonNeumann(java.lang.String name,
                              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

getCellsNear

public final Cell[] getCellsNear(Cell centralAgent,
                                 int distance,
                                 boolean includeSelf)
Effeciently 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 ScapeArray2D

getDistance

public int getDistance(Cell origin,
                       Cell target)
Returns the shortest distance between one cell and the other, assuming a walk between the two cells. In a von Neumann neighborhood, this distance is equal to the sum of each dimension distance.
Overrides:
getDistance in class ScapeGraph

(c) 1998-2000 The Brookings Insitution
Webpage