|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The InternalRepresentation
interface specifies
the methods that any internal representation of the
Grid
class must implement.
Method Summary | |
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. |
Method Detail |
public boolean isValid(Location loc)
loc
- location to check
true
if loc
is valid;
false
otherwisepublic int numObjects()
public GridObject[] allObjects()
public GridObject objectAt(Location loc)
loc
- the location in which to look
loc
;
null
if loc
is not
in the grid or is emptypublic void 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 addedpublic void remove(GridObject obj)
obj
is in this environment; verified
by the Grid
object.)
obj
- the object to be removed
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |