|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectinfo.gridworld.grid.AbstractGrid<E>
public abstract class AbstractGrid<E>
AbstractGrid contains the methods that are common to grid
implementations.
The implementation of this class is testable on the AP CS AB exam.
| Constructor Summary | |
|---|---|
AbstractGrid()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface info.gridworld.grid.Grid |
|---|
get, getNumCols, getNumRows, getOccupiedLocations, isValid, put, remove |
| Constructor Detail |
|---|
public AbstractGrid()
| Method Detail |
|---|
public ArrayList<E> getNeighbors(Location loc)
Gridloc is valid in this grid
getNeighbors in interface Grid<E>loc - a location in this grid
loc in this gridpublic ArrayList<Location> getValidAdjacentLocations(Location loc)
Gridloc is valid in this grid
getValidAdjacentLocations in interface Grid<E>loc - a location in this grid
loc
in this gridpublic ArrayList<Location> getEmptyAdjacentLocations(Location loc)
Gridloc is valid in this grid
getEmptyAdjacentLocations in interface Grid<E>loc - a location in this grid
loc in this gridpublic ArrayList<Location> getOccupiedAdjacentLocations(Location loc)
Gridloc is valid in this grid
getOccupiedAdjacentLocations in interface Grid<E>loc - a location in this grid
loc in this gridpublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||