Package org.baseagent.grid
Class Grid
java.lang.Object
org.baseagent.sim.SimulationComponent
org.baseagent.grid.Grid
- All Implemented Interfaces:
SimulationListener,Universe
-
Nested Class Summary
Nested classes/interfaces inherited from class org.baseagent.sim.SimulationComponent
SimulationComponent.Type -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGridLayer(String name, GridLayer layer) doubleaverage4Neighbors(int x, int y) doubleaverage8Neighbors(int x, int y) doubleaverage9Neighbors(int x, int y) voidclear(int x, int y) voidclear(GridPosition position) longintcount4Neighbors(int x, int y, Predicate<? super Object> predicate) intcount8Neighbors(int x, int y, Predicate<? super Object> predicate) createGridLayer(String name, GridLayer.GridLayerUpdateOption updateOption) current()voiddebug(PrintStream s) voidvoidvoidget(int x, int y) get(GridPosition position) intgetBooleanAsOneOrZero(int x, int y, Predicate<? super Object> predicate) getGridLayer(String name) intgetOrCreateGridLayer(String name, GridLayer.GridLayerUpdateOption updateOption) getType()intvoidinit()iterator()doublelaplacian_3x3(int x, int y, double centerWeight, double adjacentWeight, double diagonalWeight) next()voidonAfterStepStarted(Simulation simulation) voidonBeforeStepEnded(Simulation simulation) voidvoidremoveGridLayer(String name) voidvoidvoidvoidvoidvoidvoidset(GridPosition position, Object value) voidsetBoundsPolicy(GridBoundsPolicy boundsPolicy) voidsetStepPolicy(GridStepPolicy stepPolicy) voidsetUpdateOption(GridLayer.GridLayerUpdateOption updateOption) voidstep0(Simulation simulation) voidswap()Methods inherited from class org.baseagent.sim.SimulationComponent
getSimulation, getUUID, setSimulationMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.baseagent.sim.SimulationListener
onAfterStepEnded, onBeforeStepStarted, onSimulationComponentAdded, onSimulationComponentRemoved, onSimulationEnded, onSimulationPaused, onSimulationResumed, onSimulationStarted, onSimulationStopped, onStepEnded, onStepStarted
-
Field Details
-
DEFAULT_GRID_LAYER
-
-
Constructor Details
-
Grid
public Grid(int widthInCells, int heightInCells)
-
-
Method Details
-
getWidthInCells
public int getWidthInCells() -
getHeightInCells
public int getHeightInCells() -
setBoundsPolicy
-
getBoundsPolicy
-
setStepPolicy
-
getStepPolicy
-
createGridLayer
-
addGridLayer
-
getGridLayer
-
getOrCreateGridLayer
-
removeGridLayer
-
step0
-
getGridLayers
-
init
public void init() -
swap
public void swap() -
getType
- Specified by:
getTypein classSimulationComponent
-
onAfterStepStarted
- Specified by:
onAfterStepStartedin interfaceSimulationListener
-
onBeforeStepEnded
- Specified by:
onBeforeStepEndedin interfaceSimulationListener
-
debug
-
getLayerName
-
current
-
next
-
getUpdateOption
-
setUpdateOption
-
persist
-
iterator
-
fill
-
fill
-
laplacian_3x3
public double laplacian_3x3(int x, int y, double centerWeight, double adjacentWeight, double diagonalWeight) -
set
-
set
-
clear
public void clear(int x, int y) -
clear
-
get
-
get
-
count8Neighbors
-
count4Neighbors
-
average9Neighbors
public double average9Neighbors(int x, int y) -
average8Neighbors
public double average8Neighbors(int x, int y) -
average4Neighbors
public double average4Neighbors(int x, int y) -
count
-
getBooleanAsOneOrZero
-
scatter
-
scatter
-
scatter
-
scatter
-
scatter
-
form
-
getRandomUnoccupiedPosition
-