|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.cfpm.caves.za.Person
public class Person
An individual person. Used as a shadow fact in Jess.
Field Summary | |
---|---|
(package private) jess.Value |
achievedEducation
|
static int |
ADULT_AGE_LIMIT
|
(package private) int |
age
|
(package private) EndorsementScheme |
agentEndorsementScheme
|
(package private) boolean |
alive
|
(package private) boolean |
atSchool
|
(package private) int |
birthMonth
|
(package private) int |
birthWeek
|
(package private) java.util.ArrayList<BurialSociety> |
burialSocieties
|
static int |
CHILD_AGE_LIMIT
|
(package private) java.util.ArrayList<jess.Value> |
children
|
(package private) java.util.ArrayList<Person> |
currentPartners
|
(package private) int |
deathWeek
|
static java.lang.String[] |
educationLevels
|
(package private) jess.Rete |
engine
|
(package private) jess.Value |
father
|
(package private) EndorsementScheme |
friendEndorsementScheme
|
(package private) java.util.ArrayList<jess.Value> |
friends
|
(package private) jess.Value |
gender
|
(package private) boolean |
head
|
(package private) HIVAIDS |
hivAIDS
|
(package private) Household |
household
|
(package private) java.util.ArrayList<jess.Value> |
knownPersons
|
(package private) int |
lastDelivery
|
(package private) int |
lastVisit
|
static java.lang.String[] |
maritalStates
|
(package private) jess.Value |
maritalStatus
|
static double |
MAX_BASE
|
static int |
MAX_CLASSES
|
int |
maxNumFriends
|
int |
maxNumPartners
|
(package private) boolean |
migrant
|
static double |
MIN_BASE
|
static int |
MIN_CLASSES
|
(package private) SouthAfricaModel |
model
|
(package private) jess.Value |
mother
|
(package private) jess.Value |
name
|
private static java.lang.String[] |
negativeEndorsementTokenStrings
|
(package private) NetworkNode |
node
|
private int |
numEndorsementClasses
|
(package private) boolean |
onVisit
|
(package private) java.util.ArrayList<java.lang.Integer> |
partnershipStart
|
private java.beans.PropertyChangeSupport |
pcs
|
private static java.lang.String[] |
positiveEndorsementTokenStrings
|
(package private) boolean |
registeredForPension
|
(package private) java.util.ArrayList<jess.Value> |
siblings
|
(package private) Person |
spouse
|
(package private) java.util.ArrayList<Stokvel> |
stokvels
|
(package private) int[] |
tag
|
double |
tagEvolutionPropensity
|
Constructor Summary | |
---|---|
Person(java.lang.String nameString,
Household hhold,
SouthAfricaModel model)
Creates a new person with the given name |
Method Summary | |
---|---|
private void |
addAgentEndorsementScheme(double base)
Creates an empty endorsement scheme for the agent |
void |
addChild(Person child)
add a child for this agent |
void |
addCurrentPartner(Person p)
adds the given sexual partner |
private void |
addFriendEndorsementScheme(double base)
Creates an empty friend endorsement scheme for the agent |
void |
addKnownPerson(java.lang.String personString)
adds the given person to the list of known persons |
void |
addKnownPerson(jess.Value person)
adds the given person to the list of known persons |
void |
addKnownPersons(java.util.ArrayList<jess.Value> persons)
adds the given persons to the list of known persons |
void |
addKnownPersons(jess.Value[] persons)
adds the given persons to the list of known persons |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener p)
adds a property change listener (for Jess) |
void |
addSibling(Person sibling)
add a sibling for this agent |
void |
assertEmployment(java.lang.String employer,
double wage,
int durationInMonths)
Assert an employment fact in the Jess fact base to show that this agent has been employed by the given employer for the specified wage and time. |
void |
assertEmployment(jess.Value employer,
double wage,
int durationInMonths)
Assert an employment fact in the Jess fact base to show that this agent has been employed by the given employer for the specified wage and time. |
void |
assertNeighbourEndorsement(Person neighbour)
endorse the given neighbour, i.e. assert a new endorsed fact with endorsement "is-neighbour" for this agent |
void |
assertSameClubEndorsement(Person fellowMember)
endorse the given fellow club member, i.e assert a new endorsed fact with endorsement "same-club" |
private boolean |
checkMaritalStatusValidity(jess.Value ms)
internal helper function: checks if the given Value is a valid marital status |
private void |
createAgentEndorsementTokens()
Creates the contents of the agent's endorsement scheme, i.e. creates particular weights for the endorsement tokens. |
private void |
createFriendEndorsementTokens()
Creates the contents for the friend endorsement scheme that ranks "most-similar" and "similar" highest |
void |
createTag()
Creates this person's tag, i.e. characteristic traits modelled as a list of digits |
(package private) void |
die(int tick)
lets the agent die in the current tick |
private Person |
findBestAccommodator(java.util.ArrayList<Person> relatives)
internal helper function: find the relative whose household is best suited to accomodate this agent (who is an orphan) |
(package private) Person |
findLivingRelative(boolean forAccommodation)
searches for the closest living relative of this agent |
private Person |
findYoungestSon(java.util.ArrayList<Person> children)
internal helper function: determine youngest son of this agent to inherit the house of this agent (who has died) |
jess.Value |
getAchievedEducation()
returns the achieved education level |
int |
getAge()
returns the agent's age |
EndorsementScheme |
getAgentEndorsementScheme()
returns the agent endorsement scheme |
int |
getBirthMonth()
returns the agent's birth month |
int |
getBirthWeek()
returns the agent's birth week |
jess.Value[] |
getBurialSocieties()
returns the burial societies this agent is a member of |
jess.Value[] |
getChildren()
returns the children of this agent |
jess.Value[] |
getCurrentPartners()
returns the current sexual partners |
int |
getDeathWeek()
returns the agent's death week |
jess.Value |
getFather()
returns this agent's father |
EndorsementScheme |
getFriendEndorsementScheme()
returns the friend endorsement scheme |
protected java.util.ArrayList<Person> |
getFriends()
returns this agent's friends |
jess.Value |
getGender()
returns the agent's gender |
Household |
getHousehold()
returns this agent's household |
jess.Value |
getHouseholdID()
returns the ID of this agent's household |
int |
getInfectedSince()
returns the tick this agent contracted HIV |
protected java.util.ArrayList<Person> |
getKin()
retrieves relatives in other households (from kinship network) |
jess.Value[] |
getKnownPersons()
returns the persons this agent knows |
int |
getLastDelivery()
returns the tick when this agent last gave birth |
int |
getLastVisit()
returns the tick when this agent last visited home (from being a migrant) |
jess.Value |
getMaritalStatus()
returns the agent's marital status |
int |
getMaxNumFriends()
returns the agent's maximal number of friends |
int |
getMaxNumPartners()
returns the agent's maximal number of sexual partners |
SouthAfricaModel |
getModel()
returns a reference to the model |
jess.Value |
getMother()
returns this agent's mother |
jess.Value |
getName()
returns the agent's name |
NetworkNode |
getNode()
return this agent's network node |
protected int |
getNumKinHouseholds()
returns the number of kin households, i.e. the number of households this agent's household maintains a kinship link with |
protected jess.Value[] |
getParents()
returns the parents of this agent |
jess.Value[] |
getSiblings()
returns the siblings of this agent |
Person |
getSpouse()
returns this agent's spouse |
jess.Value[] |
getStokvels()
returns thestokvels this agent is a member of |
int[] |
getTag()
returns the agent's tag |
double |
getTagEvolutionPropensity()
returns this agent's tag evolution propensity |
protected boolean |
hasAIDS()
returns if this agent has developed AIDS |
boolean |
isAlive()
returns the agent's life state |
boolean |
isAtSchool()
returns if the agent is attending school or not |
boolean |
isHead()
returns if the agent is head of its household |
protected boolean |
isHIVPositive()
returns if this agent has contracted HIV |
boolean |
isMigrant()
returns if the agent is a migrant |
boolean |
isOnVisit()
returns if the agent is a migrant currently home on a visit |
boolean |
isRegisteredForPension()
returns if this agent is registered to receive a state pension |
void |
joinBurialSociety(BurialSociety bs)
lets this agent join the specified burial society |
void |
joinStokvel(Stokvel s)
lets the agent join the specified stokvel |
void |
leaveBurialSociety(BurialSociety bs)
lets this agent leave the specified burial society |
void |
leaveStokvel(Stokvel s)
lets the agent leave the specified stokvel |
void |
marry(Person spouse)
let this agent marry the given person |
private Person |
pickRandomlyFromSameVillage(java.util.ArrayList<Person> relatives)
internal helper function: pick a random relative from the same village (if possible) |
void |
printEndorsementScheme()
prints the agent endorsement scheme to console |
boolean |
rate(java.lang.String endorsementString,
double performanceValue)
lets the agent rate the performance of another agent with regard to the given endorsement token. |
boolean |
rate(jess.Value endorsement,
double performanceValue)
lets the agent rate the performance of another agent with regard to the given endorsement token. |
void |
removeCurrentPartner(Person p)
removes the given sexual partner |
void |
removeCurrentPartners()
removes all current sexual partners |
private java.util.ArrayList<Person> |
removeDead(java.util.ArrayList<Person> list)
internal helper function: removes the dead persons from a list of persons |
void |
removeKnownPerson(jess.Value person)
removes the given person from the list of known persons |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener p)
removes a property change listener (for Jess) |
void |
removeSameClubEndorsement(Person fellowMember)
un-endorse the given fellow club member, i.e retract the endorsed fact with endorsement "same-club" for this agent |
void |
setAchievedEducation(int levelIndex)
sets the achieved education level to the given level |
void |
setAchievedEducation(java.lang.String elString)
sets the achieved education level to the given level |
protected void |
setAchievedEducation(jess.Value level)
sets the achieved education level to the given level |
void |
setAge(int age)
sets the agent's age |
void |
setAgentEndorsementScheme(EndorsementScheme es)
sets the agent endorsement scheme and propagates change to Jess |
void |
setAlive(boolean alive)
sets the agent's life state |
void |
setAtSchool(boolean atSchool)
sets if this agent is attending school or not |
void |
setBirthMonth(int birthMonth)
sets the agent's birth month |
void |
setBirthWeek(int birthWeek)
sets the agent's birth week |
void |
setDeathWeek(int deathWeek)
sets the agent's death week |
void |
setFriendEndorsementScheme(EndorsementScheme es)
sets the friend endorsement scheme and propagates change to Jess |
void |
setGender(java.lang.String genderString)
sets the agent's gender |
void |
setGender(jess.Value gender)
sets the agent's gender |
void |
setHead(boolean hhHead)
sets if the agent is head of its household |
void |
setHousehold(Household household)
sets this agent's household. |
void |
setInfectedSince(int tick)
sets the tick this agent contracted HIV |
void |
setInfectedSince(int tick,
int stage)
sets the tick this agent contracted HIV and the stage of the disease |
void |
setLastDelivery(int lastDelivery)
sets the tick when this agent last gave birth |
void |
setLastVisit(int tick)
sets the tick when this agent last visited home (from being a migrant) |
void |
setMaritalStatus(int n)
sets the agent's marital status |
void |
setMaritalStatus(java.lang.String msString)
sets the agent's marital status |
void |
setMaritalStatus(jess.Value ms)
sets the agent's marital status |
void |
setMaxNumFriends(int n)
sets the agent's maximal number of friends |
void |
setMaxNumPartners(int n)
sets the agent's maximal number of sexual partners |
void |
setMigrant(boolean migrant)
sets if the agent is a migrant |
void |
setModel(SouthAfricaModel model)
sets a reference to the model |
void |
setName(java.lang.String nameString)
sets the agent's name |
void |
setName(jess.Value name)
sets the agent's name |
void |
setNode(NetworkNode node)
sets this agent's network node |
void |
setOnVisit(boolean onVisit)
sets if the agent is a migrant currently home on a visit |
void |
setRegisteredForPension(boolean registeredForPension)
sets if this agent is registered to receive a state pension |
void |
setSpouse(Person spouse)
sets the agent's spouse |
void |
setTag(int[] tag)
sets the agent's tag |
void |
setTagEvolutionPropensity(double tep)
sets this agent's tag evolution propensity |
java.lang.String |
toString()
returns a String representation of this person. |
void |
update(int currentTime)
updates the agent for the current tick. |
private void |
updatePartnerDuration(Person p)
internal helper function: updates the partner duration for the given partner |
private void |
updatePartnerDuration(Person p,
int duration)
internal helper function: update recorded data about partnership duration |
void |
updateTag(Person[] friends,
double[] endorsementValues)
Updates the agent's tag. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int CHILD_AGE_LIMIT
public static final int ADULT_AGE_LIMIT
public static final java.lang.String[] maritalStates
public static final java.lang.String[] educationLevels
private static java.lang.String[] positiveEndorsementTokenStrings
private static java.lang.String[] negativeEndorsementTokenStrings
public static final double MIN_BASE
public static final double MAX_BASE
public static final int MIN_CLASSES
public static final int MAX_CLASSES
jess.Value name
int age
int birthMonth
int birthWeek
int deathWeek
jess.Value gender
jess.Value maritalStatus
jess.Value achievedEducation
boolean head
boolean alive
boolean migrant
boolean onVisit
int lastVisit
boolean registeredForPension
boolean atSchool
int lastDelivery
public int maxNumFriends
public int maxNumPartners
HIVAIDS hivAIDS
SouthAfricaModel model
Household household
Person spouse
jess.Value father
jess.Value mother
java.util.ArrayList<jess.Value> children
java.util.ArrayList<jess.Value> siblings
java.util.ArrayList<jess.Value> friends
java.util.ArrayList<jess.Value> knownPersons
java.util.ArrayList<Person> currentPartners
java.util.ArrayList<java.lang.Integer> partnershipStart
NetworkNode node
java.util.ArrayList<BurialSociety> burialSocieties
java.util.ArrayList<Stokvel> stokvels
private int numEndorsementClasses
EndorsementScheme agentEndorsementScheme
EndorsementScheme friendEndorsementScheme
int[] tag
public double tagEvolutionPropensity
jess.Rete engine
private java.beans.PropertyChangeSupport pcs
Constructor Detail |
---|
public Person(java.lang.String nameString, Household hhold, SouthAfricaModel model)
nameString
- name of the personhhold
- household of the personmodel
- the modelMethod Detail |
---|
public void createTag()
private void createAgentEndorsementTokens()
private void createFriendEndorsementTokens()
private void addAgentEndorsementScheme(double base)
base
- the baseprivate void addFriendEndorsementScheme(double base)
base
- the basepublic void setFriendEndorsementScheme(EndorsementScheme es)
es
- the endorsement schemepublic EndorsementScheme getFriendEndorsementScheme()
public void setAgentEndorsementScheme(EndorsementScheme es)
es
- the endorsement schemepublic EndorsementScheme getAgentEndorsementScheme()
public void updateTag(Person[] friends, double[] endorsementValues)
friends
- list of friendsendorsementValues
- list of friends' overall endorsement valuespublic void assertEmployment(jess.Value employer, double wage, int durationInMonths)
employer
- name of the agent's employerwage
- monthly wagedurationInMonths
- duration of employment in monthspublic void assertEmployment(java.lang.String employer, double wage, int durationInMonths)
employer
- name of the agent's employer as Stringwage
- monthly wagedurationInMonths
- duration of employment in monthspublic int[] getTag()
public void setTag(int[] tag)
tag
- the new tagpublic int getAge()
public void setAge(int age)
age
- the agepublic jess.Value getGender()
public void setGender(jess.Value gender)
gender
- the gender as a Value objectpublic void setGender(java.lang.String genderString)
genderString
- the gender as a Stringpublic int getMaxNumFriends()
public void setMaxNumFriends(int n)
n
- upper limit on the number of friendspublic int getMaxNumPartners()
public void setMaxNumPartners(int n)
n
- upper limit on the number of partnerspublic int getBirthMonth()
public void setBirthMonth(int birthMonth)
birthMonth
- month the agent was born as int between 0 and 11public int getBirthWeek()
public void setBirthWeek(int birthWeek)
birthWeek
- week the agent was born as int between 0 and 3public int getDeathWeek()
public void setDeathWeek(int deathWeek)
deathWeek
- week the agent died as int between 0 and 3public jess.Value getName()
public void setName(jess.Value name)
name
- name as a Value objectpublic void setName(java.lang.String nameString)
nameString
- name as a Stringpublic Person getSpouse()
public void setSpouse(Person spouse)
spouse
- the spousepublic void setMaritalStatus(jess.Value ms)
ms
- marital status as a Value objectpublic void setMaritalStatus(int n)
n
- marital status as index into the list of marital statespublic void setMaritalStatus(java.lang.String msString)
msString
- marital status as Stringpublic jess.Value getMaritalStatus()
private boolean checkMaritalStatusValidity(jess.Value ms)
ms
- the marital status as a Value
public boolean isAlive()
public void setAlive(boolean alive)
alive
- true for alive, false for deadpublic boolean isHead()
public void setHead(boolean hhHead)
hhHead
- true if the agent is household head, false otherwisepublic jess.Value getHouseholdID()
public Household getHousehold()
public void setHousehold(Household household)
household
- the householdpublic NetworkNode getNode()
public void setNode(NetworkNode node)
node
- the nodepublic SouthAfricaModel getModel()
public void setModel(SouthAfricaModel model)
model
- the modelpublic void addPropertyChangeListener(java.beans.PropertyChangeListener p)
public void removePropertyChangeListener(java.beans.PropertyChangeListener p)
public void update(int currentTime)
currentTime
- the current model tickvoid die(int tick)
tick
- the current model tickpublic boolean isMigrant()
public void setMigrant(boolean migrant)
migrant
- true if the agent is a migrant, false otherwisepublic boolean isOnVisit()
public void setOnVisit(boolean onVisit)
onVisit
- true if home on a visit, false otherwisepublic int getLastVisit()
public void setLastVisit(int tick)
tick
- tick of last visit homepublic int getLastDelivery()
public void setLastDelivery(int lastDelivery)
lastDelivery
- tick of last deliverypublic double getTagEvolutionPropensity()
public void setTagEvolutionPropensity(double tep)
tep
- the new tag evoluation propensitypublic boolean isRegisteredForPension()
public void setRegisteredForPension(boolean registeredForPension)
registeredForPension
- true if agent is registered, false otherwisepublic jess.Value[] getKnownPersons()
public void addKnownPerson(jess.Value person)
person
- name of personpublic void addKnownPerson(java.lang.String personString)
personString
- name of person as Stringpublic void addKnownPersons(java.util.ArrayList<jess.Value> persons)
persons
- list of personspublic void addKnownPersons(jess.Value[] persons)
persons
- list of person namespublic void removeKnownPerson(jess.Value person)
person
- name of the person to be removedpublic void printEndorsementScheme()
public jess.Value getFather()
public jess.Value getMother()
protected jess.Value[] getParents()
public jess.Value[] getChildren()
public jess.Value[] getSiblings()
public void addChild(Person child)
child
- this agent's new childpublic void addSibling(Person sibling)
sibling
- this agent's new siblingPerson findLivingRelative(boolean forAccommodation)
forAccommodation
- true if the relative is to accomodate the agent, false if the relative
is to inherit
private Person pickRandomlyFromSameVillage(java.util.ArrayList<Person> relatives)
private Person findYoungestSon(java.util.ArrayList<Person> children)
private Person findBestAccommodator(java.util.ArrayList<Person> relatives)
private java.util.ArrayList<Person> removeDead(java.util.ArrayList<Person> list)
public void joinBurialSociety(BurialSociety bs)
bs
- burial societypublic void leaveBurialSociety(BurialSociety bs)
bs
- burial societypublic jess.Value[] getBurialSocieties()
public void joinStokvel(Stokvel s)
s
- the stokvelpublic void leaveStokvel(Stokvel s)
s
- the stokvelpublic jess.Value[] getStokvels()
public boolean rate(jess.Value endorsement, double performanceValue)
endorsement
- the endorsement in question (e.g. reliable)performanceValue
- the given performance, measured as proportion of 1.0
public boolean rate(java.lang.String endorsementString, double performanceValue)
endorsementString
- the endorsement in question (e.g. reliable) as StringperformanceValue
- the given performance, measured as proportion of 1.0
public boolean isAtSchool()
public void setAtSchool(boolean atSchool)
atSchool
- true if the agent is still at school, false otherwisepublic jess.Value getAchievedEducation()
protected void setAchievedEducation(jess.Value level)
level
- education level as a Value objectpublic void setAchievedEducation(int levelIndex)
levelIndex
- education level as an index into the list of education levelspublic void setAchievedEducation(java.lang.String elString)
elString
- education level as Stringpublic void marry(Person spouse)
spouse
- this agent's new spousepublic int getInfectedSince()
public void setInfectedSince(int tick)
tick
- tick of HIV infectionpublic void setInfectedSince(int tick, int stage)
tick
- tick of HIV infectionstage
- stage of HIV progressionpublic jess.Value[] getCurrentPartners()
public void addCurrentPartner(Person p)
p
- the new sexual partnerpublic void removeCurrentPartner(Person p)
p
- sexual partner to be removedprivate void updatePartnerDuration(Person p)
private void updatePartnerDuration(Person p, int duration)
public void removeCurrentPartners()
protected boolean isHIVPositive()
protected boolean hasAIDS()
protected java.util.ArrayList<Person> getFriends()
protected java.util.ArrayList<Person> getKin()
protected int getNumKinHouseholds()
public java.lang.String toString()
toString
in class java.lang.Object
public void assertNeighbourEndorsement(Person neighbour)
neighbour
- the neighbourpublic void assertSameClubEndorsement(Person fellowMember)
fellowMember
- the fellow club memberpublic void removeSameClubEndorsement(Person fellowMember)
fellowMember
- the fellow club member
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |