Class Area
Class Area
java.lang.Object
|
+----Area
- public class Area
- extends Object
- Version:
- 1.0
Datatype for an area.
- Author:
- Torbjörn Nilsson & Nicklas Hjalmarsson
-
Area(int, int)
- Default constructor.
-
Area(String)
- Use this contructor ONLY when you have received data on the toForm-form
-
addCity(String)
-
-
addDragon(String)
-
-
getBorderingArea(Area[][])
-
-
getCity()
- Returns the name of the city in this area, if any.
-
getDragons()
- Get all dragons in this area as an Enumeration.
-
getSurroundings(Area[][], int, int, int)
- This method will return the immediate surrounding to the given coord
according tho the map, and nr suggests the number of areas to return, 4 or 9 or ...
-
getTerrain()
-
-
gotTalisman()
- Is a part of the Talisman in this area?
-
hasCity()
- Is there a city in this area?
-
main(String[])
-
-
put(Area[][])
-
-
removeCity()
-
-
removeDragon(String)
-
-
setTalisman()
- Marks that this area contains a part of the Talisman.
-
toForm()
- Turn the Area object into something sendable by sockets.
-
toString()
-
Area
public Area(int x,
int y)
- Default constructor.
Area
public Area(String data)
- Use this contructor ONLY when you have received data on the toForm-form
getDragons
public Enumeration getDragons()
- Get all dragons in this area as an Enumeration.
toForm
public String toForm()
- Turn the Area object into something sendable by sockets.
toString
public String toString()
- Overrides:
- toString in class Object
addCity
public boolean addCity(String name)
- Returns:
- If the city was accepted, ie the first in this area, True is returned.
Otherwize the city is not installed in this area, and False is returned.
removeCity
public void removeCity()
addDragon
public boolean addDragon(String dragon)
- Returns:
- If there is already a dragon in this Area with the given name
then True is returned, nothing was added. Success returns False
removeDragon
public void removeDragon(String dragon)
setTalisman
public void setTalisman()
- Marks that this area contains a part of the Talisman.
gotTalisman
public boolean gotTalisman()
- Is a part of the Talisman in this area?
hasCity
public boolean hasCity()
- Is there a city in this area?
getCity
public String getCity()
- Returns the name of the city in this area, if any.
getTerrain
public String getTerrain()
put
public Area put(Area map[][])
getBorderingArea
public Area getBorderingArea(Area map[][])
getSurroundings
public static Vector getSurroundings(Area map[][],
int x,
int y,
int nr)
- This method will return the immediate surrounding to the given coord
according tho the map, and nr suggests the number of areas to return, 4 or 9 or ...
The method assures that the returned areas are ON the map!
main
public static void main(String args[])