protected static interface Grid.InternalRepresentation
InternalRepresentation interface specifies
the methods that any internal representation of the
Grid class must implement.| Modifier and Type | Method and Description |
|---|---|
void |
add(GridObject obj)
Adds a new object to this environment at the location it specifies.
|
GridObject[] |
allObjects()
Returns all the objects in this grid.
|
boolean |
isValid(Location loc)
Verifies whether a location is valid in this grid.
|
int |
numObjects()
Returns the number of objects in this grid.
|
GridObject |
objectAt(Location loc)
Returns the object at a specific location in this grid.
|
void |
remove(GridObject obj)
Removes the object from this environment.
|
boolean isValid(Location loc)
loc - location to checktrue if loc is valid;
false otherwiseint numObjects()
GridObject[] allObjects()
GridObject objectAt(Location loc)
loc - the location in which to lookloc;
null if loc is not
in the grid or is emptyvoid add(GridObject obj)
obj.grid() is this grid and
obj.location() is a valid empty location;
verified by the Grid object.)obj - the new object to be addedvoid remove(GridObject obj)
obj is in this environment; verified
by the Grid object.)obj - the object to be removed