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 TypeMethodDescriptionvoid
addGridLayer
(String name, GridLayer layer) double
average4Neighbors
(int x, int y) double
average8Neighbors
(int x, int y) double
average9Neighbors
(int x, int y) void
clear
(int x, int y) void
clear
(GridPosition position) long
int
count4Neighbors
(int x, int y, Predicate<? super Object> predicate) int
count8Neighbors
(int x, int y, Predicate<? super Object> predicate) createGridLayer
(String name, GridLayer.GridLayerUpdateOption updateOption) current()
void
debug
(PrintStream s) void
void
void
get
(int x, int y) get
(GridPosition position) int
getBooleanAsOneOrZero
(int x, int y, Predicate<? super Object> predicate) getGridLayer
(String name) int
getOrCreateGridLayer
(String name, GridLayer.GridLayerUpdateOption updateOption) getType()
int
void
init()
iterator()
double
laplacian_3x3
(int x, int y, double centerWeight, double adjacentWeight, double diagonalWeight) next()
void
onAfterStepStarted
(Simulation simulation) void
onBeforeStepEnded
(Simulation simulation) void
void
removeGridLayer
(String name) void
void
void
void
void
void
void
set
(GridPosition position, Object value) void
setBoundsPolicy
(GridBoundsPolicy boundsPolicy) void
setStepPolicy
(GridStepPolicy stepPolicy) void
setUpdateOption
(GridLayer.GridLayerUpdateOption updateOption) void
step0
(Simulation simulation) void
swap()
Methods inherited from class org.baseagent.sim.SimulationComponent
getSimulation, getUUID, setSimulation
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
getType
in classSimulationComponent
-
onAfterStepStarted
- Specified by:
onAfterStepStarted
in interfaceSimulationListener
-
onBeforeStepEnded
- Specified by:
onBeforeStepEnded
in 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
-