|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectA4Shell.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 | |
|---|---|
java.util.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). |
java.util.ArrayList<E> |
getNeighbors(Location loc)
Gets the neighboring occupants in all eight compass directions (north, northeast, east, southeast, south, southwest, west, and northwest). |
java.util.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). |
java.util.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). |
java.lang.String |
toString()
Creates a string that describes this grid. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface A4Shell.Grid |
|---|
get, getNumCols, getNumRows, getOccupiedLocations, isValid, put, remove |
| Constructor Detail |
|---|
public AbstractGrid()
| Method Detail |
|---|
public java.util.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 java.util.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 java.util.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 java.util.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 java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||