All Packages Class Hierarchy This Package Previous Next Index
Class gpsys.cos.Terrain
java.lang.Object
|
+----gpsys.cos.Terrain
- public class Terrain
- extends Object
- implements Serializable
The terrain consists of a torroidal grid of squares upon which the "grass
grows". The terrain can be grown, and cut. In addition, an observer can be
set which gets update messages each time the state of the terrain changes.
- Author:
- Emmanuel PIERRE
DEA IARFA,
- See Also:
- TerrainObserver
-
CS
-
-
csnrj
-
-
l0
-
-
L0
-
-
l1
-
-
L1
-
-
l2
-
-
L2
-
-
lmax
-
-
observed
- True if the observer is wants to received state change information.
-
observer
- A reference to an observer interested in monitoring the state of this
terrain.
-
R1
-
-
R2
-
-
terrain
- Used to hold the state of each square of the terrain.
-
ttl
-
-
Terrain(int)
- Create a square terrain of the specified dimension, with no observer.
-
at(int, int, Robot)
- Sets the specified square status, and informs the
observer of the event.
-
disableObserver()
- Disables the observer from receiving change messages.
-
enableObserver()
- Enables the observer to receive change messages.
-
reinit()
- Sets the all of the squares on the terrain to initial state.
-
setObserver(TerrainObserver)
- Set the observer of the terrain to the specified observer.
-
updateTerrain()
- Update terrain's lamp status.
terrain
int terrain[][]
- Used to hold the state of each square of the terrain.
l0
int l0
l1
int l1
l2
int l2
ttl
int ttl
csnrj
int csnrj
lmax
public static final int lmax
L0
public static final int L0
L1
public static final int L1
L2
public static final int L2
R1
public static final int R1
R2
public static final int R2
CS
public static final int CS
observed
transient boolean observed
- True if the observer is wants to received state change information.
observer
transient TerrainObserver observer
- A reference to an observer interested in monitoring the state of this
terrain.
Terrain
public Terrain(int dimension)
- Create a square terrain of the specified dimension, with no observer.
- Parameters:
- dimension - The value to be used for both the height and width
of the terrain.
setObserver
public void setObserver(TerrainObserver lo)
- Set the observer of the terrain to the specified observer.
- Parameters:
- lo - The observer of the Terrain.
reinit
public final void reinit()
- Sets the all of the squares on the terrain to initial state. The
observer is notified of this change.
at
public final void at(int x,
int y,
Robot robot)
- Sets the specified square status, and informs the
observer of the event.
- Parameters:
- x - The X coordinate of the square to be cut.
- y - The Y coordinate of the square to be cut.
enableObserver
public void enableObserver()
- Enables the observer to receive change messages.
disableObserver
public void disableObserver()
- Disables the observer from receiving change messages.
updateTerrain
public void updateTerrain()
- Update terrain's lamp status.
All Packages Class Hierarchy This Package Previous Next Index