de.adom.jade.world.maps
Class Area

java.lang.Object
  extended by de.adom.jade.world.maps.Area
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
WalledArea

public class Area
extends java.lang.Object
implements java.io.Serializable

Defines an enclosed rectangular area on the map that possesses certain special qualitities.

See Also:
Serialized Form

Constructor Summary
Area(int lx, int ly, int rx, int ry, java.lang.String description)
          Defines an area.
 
Method Summary
 boolean canEnter(Being being)
          Checks whether the given being can enter the area.
 boolean canExit(Being being)
          Checks whether the given being can exit the area.
 boolean contains(int x, int y)
          Checks whether a given position is contained in an area.
 void drawOn(Map map)
          Draws the area on the given map.
 java.lang.String getDescription()
          Returns the description of the area.
 int getX1()
          Returns the left x coordinate of the area
 int getX2()
          Returns the right x coordinate of the area
 int getY1()
          Returns the left y coordinate of the area
 int getY2()
          Returns the right y coordinate of the area
 boolean isEnteredBy(Being being)
          Checks whether the given being can enter the area.
 boolean isExitedBy(Being being)
          Checks whether the given being can exit the area.
 java.lang.String toString()
          Returns a string representation of this area.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Area

public Area(int lx,
            int ly,
            int rx,
            int ry,
            java.lang.String description)
Defines an area.

Parameters:
lx - the left x coordinate of the area
ly - the left y coordinate of the area
rx - the right x coordinate of the area
ry - the right y coordinate of the area
descripion - the description of the area
Method Detail

getX1

public int getX1()
Returns the left x coordinate of the area

Returns:
the left x coordinate of the area

getY1

public int getY1()
Returns the left y coordinate of the area

Returns:
the left y coordinate of the area

getX2

public int getX2()
Returns the right x coordinate of the area

Returns:
the right x coordinate of the area

getY2

public int getY2()
Returns the right y coordinate of the area

Returns:
the right y coordinate of the area

getDescription

public java.lang.String getDescription()
Returns the description of the area.

Returns:
the description of the area

isExitedBy

public boolean isExitedBy(Being being)
Checks whether the given being can exit the area. Messages might be printed and the state of the being might be changed.

Parameters:
being - the being
Returns:
a flag indicating whether the being is able to exit the area

isEnteredBy

public boolean isEnteredBy(Being being)
Checks whether the given being can enter the area. Messages might be printed and the state of the being might be changed.

Parameters:
being - the being
Returns:
a flag indicating whether the being is able to enter the area

canEnter

public boolean canEnter(Being being)
Checks whether the given being can enter the area. No messages will be printed and the state of the being won't be changed. This method only checks the theoretical possibility of entering the area.

Parameters:
being - the being
Returns:
a flag indicating whether the being is able to enter the area

canExit

public boolean canExit(Being being)
Checks whether the given being can exit the area. No messages will be printed and the state of the being won't be changed. This method only checks the theoretical possibility of entering the area.

Parameters:
being - the being
Returns:
a flag indicating whether the being is able to exit the area

contains

public boolean contains(int x,
                        int y)
Checks whether a given position is contained in an area.

Parameters:
x - the x position
y - the y position
Returns:
a boolean value indicating whether the position is contained in the area

drawOn

public void drawOn(Map map)
Draws the area on the given map. The area object will place all appropriate tiles on the map.

Parameters:
map - the map to draw the area upon

toString

public java.lang.String toString()
Returns a string representation of this area.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this area