|
|||||||||
| 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>
| Field Summary |
|---|
| Fields inherited from interface com.collegeboard.gridworld.grid.Grid |
|---|
EAST, FULL_CIRCLE, HALF_CIRCLE, HALF_LEFT, HALF_RIGHT, LEFT, NORTH, NORTHEAST, NORTHWEST, RIGHT, SOUTH, SOUTHEAST, SOUTHWEST, WEST |
| Constructor Summary | |
|---|---|
AbstractGrid()
|
|
| Method Summary | |
|---|---|
ArrayList<Location> |
getAllNeighborLocations(Location ofLoc)
Gets the valid locations of the neighbors in all directions (north, northeast, east, southeast, south, southwest, west, and northwest) |
ArrayList<Location> |
getMainNeighborLocations(Location ofLoc)
Gets the valid locations of the neighbors in the main directions (north, east, south, and west) |
Location |
getNeighborLocation(Location fromLoc,
int direction)
Gets the location in the given direction, or null if there is no valid location in that direction. |
boolean |
isValid(Location loc)
Checks whether a location is valid in this grid. |
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, numCols, numRows, put, remove |
| Constructor Detail |
|---|
public AbstractGrid()
| Method Detail |
|---|
public boolean isValid(Location loc)
Grid
isValid in interface Grid<E>loc - location to check
true if loc is valid;
false otherwisepublic String toString()
toString in class Object
public Location getNeighborLocation(Location fromLoc,
int direction)
Grid
getNeighborLocation in interface Grid<E>direction - an angle (0 degrees = Grid.NORTH,
45 degrees = Grid.NORTHWEST, etc.)
public ArrayList<Location> getMainNeighborLocations(Location ofLoc)
Grid
getMainNeighborLocations in interface Grid<E>ofLoc - the location that is queried for the neighbor locations
public ArrayList<Location> getAllNeighborLocations(Location ofLoc)
Grid
getAllNeighborLocations in interface Grid<E>ofLoc - the location that is queried for the neighbor locations
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||