|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.collegeboard.gridworld.grid.AbstractGrid<E>
public abstract class AbstractGrid<E>
This class contains the methods that are common to all grid implementations.
copyright© 2005 Cay S. Horstmann (http://horstmann.com)
| Constructor Summary | |
|---|---|
AbstractGrid()
|
|
| Method Summary | |
|---|---|
ArrayList<Location> |
getEmptyNeighborLocations(Location loc)
Gets the locations of the empty neighbors in all directions (north, northeast, east, southeast, south, southwest, west, and northwest) |
ArrayList<E> |
getNeighbors(Location loc)
Gets the neighboring occupants in all directions (north, northeast, east, southeast, south, southwest, west, and northwest) |
ArrayList<Location> |
getOccupiedNeighborLocations(Location loc)
Gets the locations of the occupied neighbors in all directions (north, northeast, east, southeast, south, southwest, west, and northwest) |
ArrayList<Location> |
getValidNeighborLocations(Location loc)
Gets the valid locations of the neighbors in all directions (north, northeast, east, southeast, south, southwest, west, and northwest) |
String |
toString()
Creates a string representing all the objects in this grid (not necessarily in any particular order). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.collegeboard.gridworld.grid.Grid |
|---|
get, getOccupiedLocations, isValid, numCols, numRows, put, remove |
| Constructor Detail |
|---|
public AbstractGrid()
| Method Detail |
|---|
public ArrayList<Location> getValidNeighborLocations(Location loc)
getValidNeighborLocations in interface Grid<E>loc - a location in the grid
public ArrayList<Location> getEmptyNeighborLocations(Location loc)
getEmptyNeighborLocations in interface Grid<E>loc - a location in the grid
public ArrayList<Location> getOccupiedNeighborLocations(Location loc)
getOccupiedNeighborLocations in interface Grid<E>loc - a location in the grid
public ArrayList<E> getNeighbors(Location loc)
getNeighbors in interface Grid<E>loc - a location in the grid
public String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||