|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface includes the methods necessary to keep track of the creatures in a two-dimensional world. In order for the design to be general, the interface adopts the following design:
1. The contents are unspecified objects.
2. The dimensions of the world array are specified by the client.
There are many ways to implement this interface. You should need to add no more than about ten lines of code to the implementation.
Method Summary | |
java.lang.Object |
get(java.awt.Point aPosition)
Determine the contents of a position in this World. |
int |
getHeight()
Determine the height of this World. |
int |
getWidth()
Determine the width of this World. |
boolean |
inRange(java.awt.Point aPosition)
Determine whether a position is in this World or not. |
void |
set(java.awt.Point aPosition,
java.lang.Object aObject)
Set a position in this World to contain an Object. |
Method Detail |
public java.lang.Object get(java.awt.Point aPosition)
aPosition
- a non-null position in this World.
public int getHeight()
public int getWidth()
public boolean inRange(java.awt.Point aPosition)
aPosition
- a non-null position.
public void set(java.awt.Point aPosition, java.lang.Object aObject)
aPosition
- a non-null position in this World.aObject
- the Object to place at aPosition. aObject may be null.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |