Village
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
cpc.sau.agents
Class Village
java.lang.Objectcpc.sau.agents.Village
public class Village
- extends java.lang.Object
An object representing a village, town or community that contains a number
of houses(Household objects) and people(Individual objects). This class is designed with very
few attributes and methods so it can easily be extended and customized.
households: an arraylist stores all household agents in this village
residents :total number of residents in this village
villagName: a string represents the name of this village
The class has two constructors for creating a new village agent.
| Constructor Summary | |
|---|---|
Village()
This constructor creates a new village with empty values. |
|
Village(java.util.ArrayList<Household> households,
java.lang.String vName)
Constructs a new village agent with two parameters. |
|
| Method Summary | |
|---|---|
void |
addNewHousehold(Household hsd)
Adds a new household to this village. |
void |
deleteHousehold(Household hsd)
Removes a household from this village |
int |
getHouseholdCount()
Returns the number of households in this village. |
java.util.ArrayList |
getHouseholdList()
Returns the list of all households in this village. |
int |
getResidents()
Calculates and returns the total number of residents in this village. |
java.lang.String |
getVName()
Returns the name of this village. |
void |
setHouseholds(java.util.ArrayList<Household> hsld)
Sets the household arraylist of this village. |
void |
setVName(java.lang.String Vname)
Sets the name of this village. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
Village
public Village()
- This constructor creates a new village with empty values. These values can be
changed with their set methods.
Village
public Village(java.util.ArrayList<Household> households, java.lang.String vName)
- Constructs a new village agent with two parameters.
- Parameters:
households- the households arraylist. It contains all households in the village.vName- the name of this village
| Method Detail |
|---|
getResidents
public int getResidents()
- Calculates and returns the total number of residents in this village. It sums the
number in individuals in each household in the village.
- Returns:
- number of residents in this village.
setVName
public void setVName(java.lang.String Vname)
- Sets the name of this village.
- Parameters:
Vname- a string value
getVName
public java.lang.String getVName()
- Returns the name of this village.
- Returns:
- the name of this village
setHouseholds
public void setHouseholds(java.util.ArrayList<Household> hsld)
- Sets the household arraylist of this village. The list contains
all households in this village.
- Parameters:
hsld- an arraylist containing all households in this village
getHouseholdList
public java.util.ArrayList getHouseholdList()
- Returns the list of all households in this village.
Each object in the list is a Household.
- Returns:
- an arraylist containing all households in this village.
getHouseholdCount
public int getHouseholdCount()
- Returns the number of households in this village.
- Returns:
- the total number of households in this village.
addNewHousehold
public void addNewHousehold(Household hsd)
- Adds a new household to this village.
- Parameters:
hsd- a household object
deleteHousehold
public void deleteHousehold(Household hsd)
- Removes a household from this village
- Parameters:
hsd- the household to be deleted
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||

cpc.sau.agents.Village

