|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Grid<E>
| Field Summary | |
|---|---|
static int |
EAST
|
static int |
FULL_CIRCLE
|
static int |
HALF_CIRCLE
|
static int |
HALF_LEFT
|
static int |
HALF_RIGHT
|
static int |
LEFT
|
static int |
NORTH
|
static int |
NORTHEAST
|
static int |
NORTHWEST
|
static int |
RIGHT
|
static int |
SOUTH
|
static int |
SOUTHEAST
|
static int |
SOUTHWEST
|
static int |
WEST
|
| Method Summary | |
|---|---|
E |
get(Location loc)
Returns the object at a specific location in this grid (must be valid) |
ArrayList<Location> |
getAllNeighborLocations(Location loc)
Gets the valid locations of the neighbors in all directions (north, northeast, east, southeast, south, southwest, west, and northwest) |
ArrayList<Location> |
getMainNeighborLocations(Location loc)
Gets the valid locations of the neighbors in the main directions (north, east, south, and west) |
Location |
getNeighborLocation(Location loc,
int angle)
Gets the location in the given direction, or null if there is no valid location in that direction. |
ArrayList<Location> |
getOccupiedLocations()
Gets the locations in this grid that contain objects. |
boolean |
isValid(Location loc)
Checks whether a location is valid in this grid. |
int |
numCols()
Returns number of columns in this grid. |
int |
numRows()
Returns number of rows in this grid. |
void |
put(Location loc,
E obj)
Adds a new object to this grid. |
E |
remove(Location loc)
Removes an object from this grid. |
| Field Detail |
|---|
static final int RIGHT
static final int HALF_RIGHT
static final int LEFT
static final int HALF_LEFT
static final int HALF_CIRCLE
static final int FULL_CIRCLE
static final int NORTH
static final int EAST
static final int SOUTH
static final int WEST
static final int NORTHEAST
static final int SOUTHEAST
static final int SOUTHWEST
static final int NORTHWEST
| Method Detail |
|---|
int numRows()
int numCols()
void put(Location loc,
E obj)
loc - the location at which to put the object (must be valid)obj - the new object to be added (must not be null)E remove(Location loc)
loc - the location of the object that is to be removed (must be valid)
E get(Location loc)
loc - the location in which to look
loc;
null if loc is emptyArrayList<Location> getOccupiedLocations()
boolean isValid(Location loc)
loc - location to check
true if loc is valid;
false otherwise
Location getNeighborLocation(Location loc,
int angle)
angle - an angle (0 degrees = Grid.NORTH,
45 degrees = Grid.NORTHWEST, etc.)
ArrayList<Location> getMainNeighborLocations(Location loc)
loc - the location that is queried for the neighbor locations
ArrayList<Location> getAllNeighborLocations(Location loc)
loc - 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 | ||||||||