public abstract class AbstractGrid<E> extends Object implements Grid<E>
AbstractGrid contains the methods that are common to grid
implementations. | Constructor and Description |
|---|
AbstractGrid() |
| Modifier and Type | Method and Description |
|---|---|
ArrayList<Location> |
getEmptyAdjacentLocations(Location loc)
Gets the valid empty locations adjacent to a given location in all eight
compass directions (north, northeast, east, southeast, south, southwest,
west, and northwest).
|
ArrayList<E> |
getNeighbors(Location loc)
Gets the neighboring occupants in all eight compass directions (north,
northeast, east, southeast, south, southwest, west, and northwest).
|
ArrayList<Location> |
getOccupiedAdjacentLocations(Location loc)
Gets the valid occupied locations adjacent to a given location in all
eight compass directions (north, northeast, east, southeast, south,
southwest, west, and northwest).
|
ArrayList<Location> |
getValidAdjacentLocations(Location loc)
Gets the valid locations adjacent to a given location in all eight
compass directions (north, northeast, east, southeast, south, southwest,
west, and northwest).
|
String |
toString()
Creates a string that describes this grid.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitget, getNumCols, getNumRows, getOccupiedLocations, isValid, put, removepublic ArrayList<E> getNeighbors(Location loc)
Gridloc is valid in this gridgetNeighbors in interface Grid<E>loc - a location in this gridloc in this gridpublic ArrayList<Location> getValidAdjacentLocations(Location loc)
Gridloc is valid in this gridgetValidAdjacentLocations in interface Grid<E>loc - a location in this gridloc
in this gridpublic ArrayList<Location> getEmptyAdjacentLocations(Location loc)
Gridloc is valid in this gridgetEmptyAdjacentLocations in interface Grid<E>loc - a location in this gridloc in this gridpublic ArrayList<Location> getOccupiedAdjacentLocations(Location loc)
Gridloc is valid in this gridgetOccupiedAdjacentLocations in interface Grid<E>loc - a location in this gridloc in this grid