|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.cfpm.caves.za.Household
public class Household
This class represents a household in a village. A household consists of a group of agents, usually but not necessarily related, who pool and share all resources. Decisions on the household level are taken by a designated household head. Used as a shadow fact in Jess.
Field Summary | |
---|---|
(package private) double |
cash
the household's available money |
(package private) jess.Value |
church
the church this household belongs to |
(package private) double |
expectedIncome
the household's expected monthly income |
(package private) Person |
head
the household head |
(package private) jess.Value |
id
the household ID |
(package private) jess.Value[] |
memberIDs
the names of the household members (for easier access in Jess) |
(package private) java.util.ArrayList<Person> |
members
the household members |
(package private) SouthAfricaModel |
model
reference to the model |
(package private) double |
monthlyFoodCost
the household's monthly food cost |
(package private) NetworkNode |
node
the associated network node for the kinship network |
private java.beans.PropertyChangeSupport |
pcs
|
(package private) double |
spendingCommitments
the household's commitments to pay for stuff |
(package private) jess.Value |
village
the village this household is situated in |
(package private) int |
x
the x coordinate of the household's position on the 2D grid |
(package private) int |
y
the y coordinate of the household's position on the 2D grid |
Constructor Summary | |
---|---|
Household(SouthAfricaModel model)
Creates a new empty household. |
|
Household(SouthAfricaModel model,
java.lang.String id,
jess.Value church,
Village village)
Create a new household for a newly-wed couple during the simulation |
Method Summary | |
---|---|
private void |
accommodate(java.util.ArrayList<Person> orphans)
internal function: let the given orphans join the household |
void |
addCash(double cash)
adds the given cash to the household's cash |
void |
addMember(Person member)
Adds the given person as a household member |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener p)
adds a property change listener (for Jess) |
double |
calculateExpectedIncome(double wages)
calculates the expected income, taking state grants and wages from employment into account |
double |
calculateMonthlyFoodCost()
calculates the monthly food cost depending on the members' age and gender, applying the food cost constants defined in the model |
double |
contributeToBurial(java.lang.String deceasedPerson,
java.lang.String deceasedHousehold,
boolean isKin)
contribute money to the burial costs of a related or neighbouring household |
private void |
determineNewHead(Person oldHead)
internal function: finds a new household head among the members |
private void |
dissolve(Person heir)
internal function: this household dissolves and the given heir inherits all assets |
void |
draw(uchicago.src.sim.gui.SimGraphics g)
draws a black circle for this household on the 2D grid display |
private Person |
findEldestMember()
internal function: finds the eldest person amongst the members to take over as household head |
private Person |
findNextEldestMember(Person p)
internal function: finds the member who is eldest after the given member |
double |
getCash()
returns the household's cash |
jess.Value |
getChurch()
returns the church this household belongs to |
double |
getExpectedIncome()
returns the expected monthly income |
Person |
getHead()
returns the household's head |
jess.Value |
getHeadID()
returns the name of the household head. |
jess.Value |
getId()
returns the household ID |
jess.Value[] |
getMemberIDs()
returns the member IDs |
java.util.ArrayList<Person> |
getMembers()
returns the household's members |
SouthAfricaModel |
getModel()
returns a reference to the model |
double |
getMonthlyFoodCost()
returns the monthly food cost |
NetworkNode |
getNode()
returns the associated network node |
double |
getSpendingCommitments()
returns the spending commitments of this household (sum of payments this household has agreed to make, e.g. food costs or wages for piece jobs) |
jess.Value |
getVillage()
returns the village this household belongs to |
int |
getX()
returns the x coordinate of the household's location |
int |
getY()
returns the y coordinate of the household's location |
(package private) boolean |
hasMember(Person p)
checks if the given person is a member of the household |
(package private) boolean |
isKinOf(Household hh)
checks if the given household is related to this household, i.e. if there is a kinhip link between the two households. |
(package private) int |
numberOfAdults()
return the number of adults amongst the members |
(package private) int |
numberOfChildren()
return the number of children amongst the members |
(package private) int |
numberOfSeniors()
return the number of seniors amongst the members |
(package private) Person |
pickRandomAdult()
returns a random adult from the household members |
void |
removeCash(double cash)
removes the specified amount from the household's cash |
void |
removeMember(Person member)
Removes the given person from the household. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener p)
removes a property change listener (for Jess) |
void |
setCash(double cash)
sets the household's cash to the given amount |
void |
setChurch(java.lang.String ch)
sets the church this household belongs to |
void |
setChurch(jess.Value ch)
sets the church this household belongs to |
void |
setExpectedIncome(double expectedIncome)
sets the expected monthly income |
void |
setHead(Person head)
sets the household's head |
void |
setId(java.lang.String newId)
sets the household ID |
void |
setId(jess.Value newId)
sets the household ID |
void |
setMemberIDs(jess.Value[] IDs)
sets the member IDs |
void |
setMembers(java.util.ArrayList<Person> mems)
sets the household's members |
void |
setMonthlyFoodCost(double monthlyFoodCost)
sets the monthly food cost |
void |
setNode(NetworkNode node)
sets the associated network node |
void |
setSpendingCommitments(double spendingCommitments)
sets the spending commitments of this household |
void |
setVillage(java.lang.String villageString)
sets the village this household belongs to |
void |
setVillage(jess.Value village)
sets the village this household belongs to |
void |
setX(int x)
sets the x coordinate of the household's location |
void |
setXY(int x,
int y)
sets the household's location on the 2D grid |
void |
setY(int y)
sets the y coordinate of the household's location |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
jess.Value id
jess.Value church
jess.Value village
Person head
java.util.ArrayList<Person> members
jess.Value[] memberIDs
double cash
double monthlyFoodCost
double expectedIncome
double spendingCommitments
NetworkNode node
int x
int y
SouthAfricaModel model
private java.beans.PropertyChangeSupport pcs
Constructor Detail |
---|
public Household(SouthAfricaModel model)
model
- the modelpublic Household(SouthAfricaModel model, java.lang.String id, jess.Value church, Village village)
model
- the modelid
- the household IDchurch
- the church the household belongs tovillage
- the village the household is situatedMethod Detail |
---|
public void setId(jess.Value newId)
newId
- the household IDpublic void setId(java.lang.String newId)
newId
- the household ID as Stringpublic jess.Value getId()
public Person getHead()
public void setHead(Person head)
head
- the hh headpublic jess.Value getHeadID()
public void setMembers(java.util.ArrayList<Person> mems)
mems
- list of memberspublic java.util.ArrayList<Person> getMembers()
public void addMember(Person member)
member
- the new memberpublic void removeMember(Person member)
member
- the leaving memberprivate void accommodate(java.util.ArrayList<Person> orphans)
orphans
- list of orphaned childrenprivate void dissolve(Person heir)
heir
- the heirprivate void determineNewHead(Person oldHead)
oldHead
- the old head who has diedprivate Person findEldestMember()
private Person findNextEldestMember(Person p)
p
- member
public jess.Value[] getMemberIDs()
public void setMemberIDs(jess.Value[] IDs)
IDs
- list of member namespublic void setChurch(jess.Value ch)
ch
- the churchpublic void setChurch(java.lang.String ch)
ch
- the church as Stringpublic jess.Value getChurch()
public NetworkNode getNode()
public void setNode(NetworkNode node)
node
- the nodepublic void addPropertyChangeListener(java.beans.PropertyChangeListener p)
public void removePropertyChangeListener(java.beans.PropertyChangeListener p)
public double getCash()
public void setCash(double cash)
cash
- amount of cashpublic void addCash(double cash)
cash
- amount to addpublic void removeCash(double cash)
cash
- amount to removepublic double getExpectedIncome()
public void setExpectedIncome(double expectedIncome)
expectedIncome
- the expected monthly incomepublic double getMonthlyFoodCost()
public void setMonthlyFoodCost(double monthlyFoodCost)
monthlyFoodCost
- monthly food costpublic double calculateMonthlyFoodCost()
public double calculateExpectedIncome(double wages)
wages
- wages from employment
public double contributeToBurial(java.lang.String deceasedPerson, java.lang.String deceasedHousehold, boolean isKin)
deceasedPerson
- the deceaseddeceasedHousehold
- the deceased's householdisKin
- kinhsip status (true = related, false = not related)
int numberOfAdults()
int numberOfChildren()
int numberOfSeniors()
public void setVillage(jess.Value village)
village
- the villagepublic void setVillage(java.lang.String villageString)
villageString
- the village as a Stringpublic jess.Value getVillage()
Person pickRandomAdult()
boolean hasMember(Person p)
p
- the person in question
public double getSpendingCommitments()
public void setSpendingCommitments(double spendingCommitments)
spendingCommitments
- the spending commitmentsboolean isKinOf(Household hh)
hh
- the household in question
public SouthAfricaModel getModel()
public int getX()
getX
in interface uchicago.src.sim.gui.Drawable
public int getY()
getY
in interface uchicago.src.sim.gui.Drawable
public void draw(uchicago.src.sim.gui.SimGraphics g)
draw
in interface uchicago.src.sim.gui.Drawable
public void setX(int x)
x
- the x coordinatepublic void setY(int y)
y
- the y coordinatepublic void setXY(int x, int y)
x
- the x coordinatey
- the y coordinate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |