de.adom.jade.world.maps
Class AreaCreator

java.lang.Object
  extended by de.adom.jade.world.maps.AreaCreator
Direct Known Subclasses:
BuildingCreator

public abstract class AreaCreator
extends java.lang.Object

Creates a defined number of areas of a specific type with predefined restrictions on their width and height. This class is used as a factory to fill maps with specific areas (e.g. rooms or buildings).


Constructor Summary
AreaCreator(java.lang.String widthDiceString, java.lang.String heightDiceString, int count)
          Defines an area creator for a number of areas.
 
Method Summary
 Area createArea(Map map)
          Tries to create a new area.
protected abstract  Area createAreaImpl(int x1, int y1, int x2, int y2)
          Creates a new area.
 boolean hasMoreAreas()
          Determines if this creator has areas left to be created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AreaCreator

public AreaCreator(java.lang.String widthDiceString,
                   java.lang.String heightDiceString,
                   int count)
Defines an area creator for a number of areas.

Parameters:
widthDice - the dice used to define the width
heightDice - the dice used to define the height
count - the number of areas
Method Detail

hasMoreAreas

public boolean hasMoreAreas()
Determines if this creator has areas left to be created.

Returns:
a boolean value indicating whether more areas should be created

createArea

public Area createArea(Map map)
Tries to create a new area.

Parameters:
map - the map to use for area creation
Returns:
either a new area or null

createAreaImpl

protected abstract Area createAreaImpl(int x1,
                                       int y1,
                                       int x2,
                                       int y2)
Creates a new area.

Parameters:
x1 - the left x position of the area
y1 - the left y position of the area
x2 - the right x position of the area
y2 - the right y position of the area
Returns:
an area with the predefined size