|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.cfpm.caves.za.Village
public class Village
This class represents a village in the model. It maintains its area in space so that new households can be placed within the boundaries of the village. Villages are placed randomly in space but don't overlap.
Field Summary | |
---|---|
(package private) static int |
buffer
buffer around villages to ensure they don't overlap |
(package private) int[] |
extension
bounding box of the village area on the 2D grid |
(package private) jess.Value |
name
name of the village |
Constructor Summary | |
---|---|
Village(java.lang.String nameString,
int[] centre,
int radius)
Creates a new village of the given name. |
|
Village(java.lang.String nameString,
int x0,
int y0,
int x1,
int y1)
Creates a new village of the given name. |
Method Summary | |
---|---|
boolean |
covers(int x,
int y)
checks if the specified location is covered by the village |
boolean |
coversWithBuffer(int x,
int y)
checks if the specified location falls within the village area plus buffer. |
int[] |
getExtension()
returns the village's spatial extension |
jess.Value |
getName()
returns the name of the village |
void |
setExtension(int[] extension)
sets the village's spatial extension (bounding box) |
void |
setName(java.lang.String nameString)
sets the village's name |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final int buffer
jess.Value name
int[] extension
Constructor Detail |
---|
public Village(java.lang.String nameString, int[] centre, int radius)
nameString
- name of the villagecentre
- x,y coordinates of the centreradius
- the radius as number of cellspublic Village(java.lang.String nameString, int x0, int y0, int x1, int y1)
nameString
- name of the villagex0
- x coordinate of the "upper left" cornery0
- y coordinate of the "upper left" cornerx1
- x coordinate of the "lower right" cornery1
- y coordinate of the "lower right" cornerMethod Detail |
---|
public void setExtension(int[] extension)
extension
- the bounding box as x,y coordinates of the upper left and lower right cornerspublic void setName(java.lang.String nameString)
nameString
- name of the villagepublic jess.Value getName()
public int[] getExtension()
public boolean covers(int x, int y)
x
- x-coordinatey
- y-coordinate
public boolean coversWithBuffer(int x, int y)
x
- x-coordinatey
- y-coordinate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |