|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.collegeboard.gridworld.grid.AbstractGrid<E>
com.collegeboard.gridworld.grid.BoundedGrid<E>
public class BoundedGrid<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 | |
|---|---|
BoundedGrid(int rows,
int cols)
Constructs an empty BoundedGrid object with the given dimensions. |
|
| Method Summary | |
|---|---|
E |
get(Location loc)
Returns the object at a specific location in this grid (must be valid) |
ArrayList<Location> |
getOccupiedLocations()
Gets the locations in this grid that contain objects. |
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. |
| Methods inherited from class com.collegeboard.gridworld.grid.AbstractGrid |
|---|
getAllNeighborLocations, getMainNeighborLocations, getNeighborLocation, isValid, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BoundedGrid(int rows,
int cols)
rows > 0 and cols > 0.)
rows - number of rows in BoundedGridcols - number of columns in BoundedGrid| Method Detail |
|---|
public int numRows()
Grid
public int numCols()
Grid
public ArrayList<Location> getOccupiedLocations()
Grid
public E get(Location loc)
Grid
loc - the location in which to look
loc;
null if loc is empty
public void put(Location loc,
E obj)
Grid
loc - the location at which to put the object (must be valid)obj - the new object to be added (must not be null)public E remove(Location loc)
Grid
loc - the location of the object that is to be removed (must be valid)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||