public class Environment
extends java.lang.Object
Constructor and Description |
---|
Environment(int gridLength)
Instantiates a new environment, which is composed of the gridlength and a three dimensional array.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int row,
int col,
int speciesValue)
Adds a unique species identifier on a grid location.
|
void |
add(Location location,
int speciesValue)
Adds a unique species identifier on a grid location.
|
void |
clearEnvOfCritters()
Clears the environment grid of all critters.
|
int[][] |
getGrid()
Gets the grid.
|
int |
getGridLength()
Gets the grid length.
|
int |
getGridValue(int row,
int col)
Gets the value of a site.
|
boolean |
isEmpty(int row,
int col)
Checks if a location on a grid does NOT have a critter.
|
boolean |
isEmpty(Location location)
Checks if a location on a grid does NOT have a critter
|
boolean |
isOccupied(int row,
int col)
Checks if a particular location is occupied by a critter.
|
boolean |
isOccupied(Location location)
Checks if a particular location is occupied by a critter.
|
void |
remove(int row,
int col)
Removes any species identifier from a particular grid location.
|
void |
remove(Location location)
Removes any species identifier from a particular grid location.
|
void |
setGrid(int[][] grid)
Replaces the current grid configuration with a new grid.
|
public Environment(int gridLength)
gridLength
- the grid lengthpublic void setGrid(int[][] grid)
grid
- a environment gridpublic int[][] getGrid()
public int getGridValue(int row, int col)
row
- the row of the locationcol
- the col of the locatonpublic int getGridLength()
public boolean isOccupied(Location location)
location
- the locationpublic boolean isOccupied(int row, int col)
row
- the row of the locationcol
- the col of the locatonpublic boolean isEmpty(Location location)
location
- the locationpublic boolean isEmpty(int row, int col)
row
- the row of the locationcol
- the col of the locatonpublic void add(Location location, int speciesValue)
location
- the locationspeciesValue
- the critter valuepublic void add(int row, int col, int speciesValue)
row
- the row of the locationcol
- the col of the locatonspeciesValue
- the critter valuepublic void remove(Location location)
location
- the locationpublic void remove(int row, int col)
row
- the row of the locationcol
- the col of the locatonpublic void clearEnvOfCritters()