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

Constructor Index

 o Area(int, int)
Default constructor.
 o Area(String)
Use this contructor ONLY when you have received data on the toForm-form

Method Index

 o addCity(String)
 o addDragon(String)
 o getBorderingArea(Area[][])
 o getCity()
Returns the name of the city in this area, if any.
 o getDragons()
Get all dragons in this area as an Enumeration.
 o 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 ...
 o getTerrain()
 o gotTalisman()
Is a part of the Talisman in this area?
 o hasCity()
Is there a city in this area?
 o main(String[])
 o put(Area[][])
 o removeCity()
 o removeDragon(String)
 o setTalisman()
Marks that this area contains a part of the Talisman.
 o toForm()
Turn the Area object into something sendable by sockets.
 o toString()

Constructors

 o Area
  public Area(int x,
              int y)
Default constructor.
 o Area
  public Area(String data)
Use this contructor ONLY when you have received data on the toForm-form

Methods

 o getDragons
  public Enumeration getDragons()
Get all dragons in this area as an Enumeration.
 o toForm
  public String toForm()
Turn the Area object into something sendable by sockets.
 o toString
  public String toString()
Overrides:
toString in class Object
 o 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.
 o removeCity
  public void removeCity()
 o 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
 o removeDragon
  public void removeDragon(String dragon)
 o setTalisman
  public void setTalisman()
Marks that this area contains a part of the Talisman.
 o gotTalisman
  public boolean gotTalisman()
Is a part of the Talisman in this area?
 o hasCity
  public boolean hasCity()
Is there a city in this area?
 o getCity
  public String getCity()
Returns the name of the city in this area, if any.
 o getTerrain
  public String getTerrain()
 o put
  public Area put(Area map[][])
 o getBorderingArea
  public Area getBorderingArea(Area map[][])
 o 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!
 o main
  public static void main(String args[])