org.cfpm.caves.za
Class Person

java.lang.Object
  extended by org.cfpm.caves.za.Person

public class Person
extends java.lang.Object

An individual person. Used as a shadow fact in Jess.

Author:
Ruth Meyer, Scott Moss

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

CHILD_AGE_LIMIT

public static final int CHILD_AGE_LIMIT
See Also:
Constant Field Values

ADULT_AGE_LIMIT

public static final int ADULT_AGE_LIMIT
See Also:
Constant Field Values

maritalStates

public static final java.lang.String[] maritalStates

educationLevels

public static final java.lang.String[] educationLevels

positiveEndorsementTokenStrings

private static java.lang.String[] positiveEndorsementTokenStrings

negativeEndorsementTokenStrings

private static java.lang.String[] negativeEndorsementTokenStrings

MIN_BASE

public static final double MIN_BASE
See Also:
Constant Field Values

MAX_BASE

public static final double MAX_BASE
See Also:
Constant Field Values

MIN_CLASSES

public static final int MIN_CLASSES
See Also:
Constant Field Values

MAX_CLASSES

public static final int MAX_CLASSES
See Also:
Constant Field Values

name

jess.Value name

age

int age

birthMonth

int birthMonth

birthWeek

int birthWeek

deathWeek

int deathWeek

gender

jess.Value gender

maritalStatus

jess.Value maritalStatus

achievedEducation

jess.Value achievedEducation

head

boolean head

alive

boolean alive

migrant

boolean migrant

onVisit

boolean onVisit

lastVisit

int lastVisit

registeredForPension

boolean registeredForPension

atSchool

boolean atSchool

lastDelivery

int lastDelivery

maxNumFriends

public int maxNumFriends

maxNumPartners

public int maxNumPartners

hivAIDS

HIVAIDS hivAIDS

model

SouthAfricaModel model

household

Household household

spouse

Person spouse

father

jess.Value father

mother

jess.Value mother

children

java.util.ArrayList<jess.Value> children

siblings

java.util.ArrayList<jess.Value> siblings

friends

java.util.ArrayList<jess.Value> friends

knownPersons

java.util.ArrayList<jess.Value> knownPersons

currentPartners

java.util.ArrayList<Person> currentPartners

partnershipStart

java.util.ArrayList<java.lang.Integer> partnershipStart

node

NetworkNode node

burialSocieties

java.util.ArrayList<BurialSociety> burialSocieties

stokvels

java.util.ArrayList<Stokvel> stokvels

numEndorsementClasses

private int numEndorsementClasses

agentEndorsementScheme

EndorsementScheme agentEndorsementScheme

friendEndorsementScheme

EndorsementScheme friendEndorsementScheme

tag

int[] tag

tagEvolutionPropensity

public double tagEvolutionPropensity

engine

jess.Rete engine

pcs

private java.beans.PropertyChangeSupport pcs
Constructor Detail

Person

public Person(java.lang.String nameString,
              Household hhold,
              SouthAfricaModel model)
Creates a new person with the given name

Parameters:
nameString - name of the person
hhold - household of the person
model - the model
Method Detail

createTag

public void createTag()
Creates this person's tag, i.e. characteristic traits modelled as a list of digits


createAgentEndorsementTokens

private void createAgentEndorsementTokens()
Creates the contents of the agent's endorsement scheme, i.e. creates particular weights for the endorsement tokens.


createFriendEndorsementTokens

private void createFriendEndorsementTokens()
Creates the contents for the friend endorsement scheme that ranks "most-similar" and "similar" highest


addAgentEndorsementScheme

private void addAgentEndorsementScheme(double base)
Creates an empty endorsement scheme for the agent

Parameters:
base - the base

addFriendEndorsementScheme

private void addFriendEndorsementScheme(double base)
Creates an empty friend endorsement scheme for the agent

Parameters:
base - the base

setFriendEndorsementScheme

public void setFriendEndorsementScheme(EndorsementScheme es)
sets the friend endorsement scheme and propagates change to Jess

Parameters:
es - the endorsement scheme

getFriendEndorsementScheme

public EndorsementScheme getFriendEndorsementScheme()
returns the friend endorsement scheme

Returns:
the endorsement scheme

setAgentEndorsementScheme

public void setAgentEndorsementScheme(EndorsementScheme es)
sets the agent endorsement scheme and propagates change to Jess

Parameters:
es - the endorsement scheme

getAgentEndorsementScheme

public EndorsementScheme getAgentEndorsementScheme()
returns the agent endorsement scheme

Returns:
the endorsement scheme

updateTag

public void updateTag(Person[] friends,
                      double[] endorsementValues)
Updates the agent's tag. Agents tend to become more similar to their best friends.

Parameters:
friends - list of friends
endorsementValues - list of friends' overall endorsement values

assertEmployment

public 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.

Parameters:
employer - name of the agent's employer
wage - monthly wage
durationInMonths - duration of employment in months

assertEmployment

public 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.

Parameters:
employer - name of the agent's employer as String
wage - monthly wage
durationInMonths - duration of employment in months

getTag

public int[] getTag()
returns the agent's tag

Returns:
the tag

setTag

public void setTag(int[] tag)
sets the agent's tag

Parameters:
tag - the new tag

getAge

public int getAge()
returns the agent's age

Returns:
the age

setAge

public void setAge(int age)
sets the agent's age

Parameters:
age - the age

getGender

public jess.Value getGender()
returns the agent's gender

Returns:
the gender

setGender

public void setGender(jess.Value gender)
sets the agent's gender

Parameters:
gender - the gender as a Value object

setGender

public void setGender(java.lang.String genderString)
sets the agent's gender

Parameters:
genderString - the gender as a String

getMaxNumFriends

public int getMaxNumFriends()
returns the agent's maximal number of friends

Returns:
upper limit on the number of friends

setMaxNumFriends

public void setMaxNumFriends(int n)
sets the agent's maximal number of friends

Parameters:
n - upper limit on the number of friends

getMaxNumPartners

public int getMaxNumPartners()
returns the agent's maximal number of sexual partners

Returns:
upper limit on the number of partners

setMaxNumPartners

public void setMaxNumPartners(int n)
sets the agent's maximal number of sexual partners

Parameters:
n - upper limit on the number of partners

getBirthMonth

public int getBirthMonth()
returns the agent's birth month

Returns:
month the agent was born as int between 0 and 11

setBirthMonth

public void setBirthMonth(int birthMonth)
sets the agent's birth month

Parameters:
birthMonth - month the agent was born as int between 0 and 11

getBirthWeek

public int getBirthWeek()
returns the agent's birth week

Returns:
week the agent was born as int between 0 and 3

setBirthWeek

public void setBirthWeek(int birthWeek)
sets the agent's birth week

Parameters:
birthWeek - week the agent was born as int between 0 and 3

getDeathWeek

public int getDeathWeek()
returns the agent's death week

Returns:
week the agent died as int between 0 and 3

setDeathWeek

public void setDeathWeek(int deathWeek)
sets the agent's death week

Parameters:
deathWeek - week the agent died as int between 0 and 3

getName

public jess.Value getName()
returns the agent's name

Returns:
name as a Value object

setName

public void setName(jess.Value name)
sets the agent's name

Parameters:
name - name as a Value object

setName

public void setName(java.lang.String nameString)
sets the agent's name

Parameters:
nameString - name as a String

getSpouse

public Person getSpouse()
returns this agent's spouse

Returns:
spouse or null if the agent isn't married

setSpouse

public void setSpouse(Person spouse)
sets the agent's spouse

Parameters:
spouse - the spouse

setMaritalStatus

public void setMaritalStatus(jess.Value ms)
sets the agent's marital status

Parameters:
ms - marital status as a Value object

setMaritalStatus

public void setMaritalStatus(int n)
sets the agent's marital status

Parameters:
n - marital status as index into the list of marital states

setMaritalStatus

public void setMaritalStatus(java.lang.String msString)
sets the agent's marital status

Parameters:
msString - marital status as String

getMaritalStatus

public jess.Value getMaritalStatus()
returns the agent's marital status

Returns:
marital status as a Value

checkMaritalStatusValidity

private boolean checkMaritalStatusValidity(jess.Value ms)
internal helper function: checks if the given Value is a valid marital status

Parameters:
ms - the marital status as a Value
Returns:
true if ms is a valid marital status, otherwise false

isAlive

public boolean isAlive()
returns the agent's life state

Returns:
true if the agent is alive, false otherwise

setAlive

public void setAlive(boolean alive)
sets the agent's life state

Parameters:
alive - true for alive, false for dead

isHead

public boolean isHead()
returns if the agent is head of its household

Returns:
true if the agent is household head, false otherwise

setHead

public void setHead(boolean hhHead)
sets if the agent is head of its household

Parameters:
hhHead - true if the agent is household head, false otherwise

getHouseholdID

public jess.Value getHouseholdID()
returns the ID of this agent's household

Returns:
household ID as a Value object

getHousehold

public Household getHousehold()
returns this agent's household

Returns:
the household

setHousehold

public void setHousehold(Household household)
sets this agent's household. This also adds the agent as a member to the given household.

Parameters:
household - the household

getNode

public NetworkNode getNode()
return this agent's network node

Returns:
the node

setNode

public void setNode(NetworkNode node)
sets this agent's network node

Parameters:
node - the node

getModel

public SouthAfricaModel getModel()
returns a reference to the model

Returns:
the model

setModel

public void setModel(SouthAfricaModel model)
sets a reference to the model

Parameters:
model - the model

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener p)
adds a property change listener (for Jess)


removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener p)
removes a property change listener (for Jess)


update

public void update(int currentTime)
updates the agent for the current tick. This includes ageing, checking for death, determining HIV infection and updating education levels.

Parameters:
currentTime - the current model tick

die

void die(int tick)
lets the agent die in the current tick

Parameters:
tick - the current model tick

isMigrant

public boolean isMigrant()
returns if the agent is a migrant

Returns:
true if the agent is a migrant, false otherwise

setMigrant

public void setMigrant(boolean migrant)
sets if the agent is a migrant

Parameters:
migrant - true if the agent is a migrant, false otherwise

isOnVisit

public boolean isOnVisit()
returns if the agent is a migrant currently home on a visit

Returns:
true if home on a visit, false otherwise

setOnVisit

public void setOnVisit(boolean onVisit)
sets if the agent is a migrant currently home on a visit

Parameters:
onVisit - true if home on a visit, false otherwise

getLastVisit

public int getLastVisit()
returns the tick when this agent last visited home (from being a migrant)

Returns:
tick of last visit home or -1 if the agent has never left yet

setLastVisit

public void setLastVisit(int tick)
sets the tick when this agent last visited home (from being a migrant)

Parameters:
tick - tick of last visit home

getLastDelivery

public int getLastDelivery()
returns the tick when this agent last gave birth

Returns:
tick of last delivery or -1 if no births yet

setLastDelivery

public void setLastDelivery(int lastDelivery)
sets the tick when this agent last gave birth

Parameters:
lastDelivery - tick of last delivery

getTagEvolutionPropensity

public double getTagEvolutionPropensity()
returns this agent's tag evolution propensity

Returns:
the tag evoluation propensity

setTagEvolutionPropensity

public void setTagEvolutionPropensity(double tep)
sets this agent's tag evolution propensity

Parameters:
tep - the new tag evoluation propensity

isRegisteredForPension

public boolean isRegisteredForPension()
returns if this agent is registered to receive a state pension

Returns:
true if agent is registered, false otherwise

setRegisteredForPension

public void setRegisteredForPension(boolean registeredForPension)
sets if this agent is registered to receive a state pension

Parameters:
registeredForPension - true if agent is registered, false otherwise

getKnownPersons

public jess.Value[] getKnownPersons()
returns the persons this agent knows

Returns:
list of person names

addKnownPerson

public void addKnownPerson(jess.Value person)
adds the given person to the list of known persons

Parameters:
person - name of person

addKnownPerson

public void addKnownPerson(java.lang.String personString)
adds the given person to the list of known persons

Parameters:
personString - name of person as String

addKnownPersons

public void addKnownPersons(java.util.ArrayList<jess.Value> persons)
adds the given persons to the list of known persons

Parameters:
persons - list of persons

addKnownPersons

public void addKnownPersons(jess.Value[] persons)
adds the given persons to the list of known persons

Parameters:
persons - list of person names

removeKnownPerson

public void removeKnownPerson(jess.Value person)
removes the given person from the list of known persons

Parameters:
person - name of the person to be removed

printEndorsementScheme

public void printEndorsementScheme()
prints the agent endorsement scheme to console


getFather

public jess.Value getFather()
returns this agent's father

Returns:
name of father

getMother

public jess.Value getMother()
returns this agent's mother

Returns:
name of mother

getParents

protected jess.Value[] getParents()
returns the parents of this agent

Returns:
list of parent names

getChildren

public jess.Value[] getChildren()
returns the children of this agent

Returns:
list of children names

getSiblings

public jess.Value[] getSiblings()
returns the siblings of this agent

Returns:
list of sibling names

addChild

public void addChild(Person child)
add a child for this agent

Parameters:
child - this agent's new child

addSibling

public void addSibling(Person sibling)
add a sibling for this agent

Parameters:
sibling - this agent's new sibling

findLivingRelative

Person findLivingRelative(boolean forAccommodation)
searches for the closest living relative of this agent

Parameters:
forAccommodation - true if the relative is to accomodate the agent, false if the relative is to inherit
Returns:
closest living relative

pickRandomlyFromSameVillage

private Person pickRandomlyFromSameVillage(java.util.ArrayList<Person> relatives)
internal helper function: pick a random relative from the same village (if possible)


findYoungestSon

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)


findBestAccommodator

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)


removeDead

private java.util.ArrayList<Person> removeDead(java.util.ArrayList<Person> list)
internal helper function: removes the dead persons from a list of persons


joinBurialSociety

public void joinBurialSociety(BurialSociety bs)
lets this agent join the specified burial society

Parameters:
bs - burial society

leaveBurialSociety

public void leaveBurialSociety(BurialSociety bs)
lets this agent leave the specified burial society

Parameters:
bs - burial society

getBurialSocieties

public jess.Value[] getBurialSocieties()
returns the burial societies this agent is a member of

Returns:
list of burial society names

joinStokvel

public void joinStokvel(Stokvel s)
lets the agent join the specified stokvel

Parameters:
s - the stokvel

leaveStokvel

public void leaveStokvel(Stokvel s)
lets the agent leave the specified stokvel

Parameters:
s - the stokvel

getStokvels

public jess.Value[] getStokvels()
returns thestokvels this agent is a member of

Returns:
list of stokvel names

rate

public boolean rate(jess.Value endorsement,
                    double performanceValue)
lets the agent rate the performance of another agent with regard to the given endorsement token. This is to decide if the agent should endorse the other agent with this endorsement.

Parameters:
endorsement - the endorsement in question (e.g. reliable)
performanceValue - the given performance, measured as proportion of 1.0
Returns:
true if the performance is good enough, false otherwise

rate

public boolean rate(java.lang.String endorsementString,
                    double performanceValue)
lets the agent rate the performance of another agent with regard to the given endorsement token. This is to decide if the agent should endorse the other agent with this endorsement.

Parameters:
endorsementString - the endorsement in question (e.g. reliable) as String
performanceValue - the given performance, measured as proportion of 1.0
Returns:
true if the performance is good enough, false otherwise

isAtSchool

public boolean isAtSchool()
returns if the agent is attending school or not

Returns:
true if the agent is still at school, false otherwise

setAtSchool

public void setAtSchool(boolean atSchool)
sets if this agent is attending school or not

Parameters:
atSchool - true if the agent is still at school, false otherwise

getAchievedEducation

public jess.Value getAchievedEducation()
returns the achieved education level

Returns:
education level

setAchievedEducation

protected void setAchievedEducation(jess.Value level)
sets the achieved education level to the given level

Parameters:
level - education level as a Value object

setAchievedEducation

public void setAchievedEducation(int levelIndex)
sets the achieved education level to the given level

Parameters:
levelIndex - education level as an index into the list of education levels

setAchievedEducation

public void setAchievedEducation(java.lang.String elString)
sets the achieved education level to the given level

Parameters:
elString - education level as String

marry

public void marry(Person spouse)
let this agent marry the given person

Parameters:
spouse - this agent's new spouse

getInfectedSince

public int getInfectedSince()
returns the tick this agent contracted HIV

Returns:
tick of HIV infection or -1 if not infected

setInfectedSince

public void setInfectedSince(int tick)
sets the tick this agent contracted HIV

Parameters:
tick - tick of HIV infection

setInfectedSince

public void setInfectedSince(int tick,
                             int stage)
sets the tick this agent contracted HIV and the stage of the disease

Parameters:
tick - tick of HIV infection
stage - stage of HIV progression

getCurrentPartners

public jess.Value[] getCurrentPartners()
returns the current sexual partners

Returns:
list of the names of the sexual partners

addCurrentPartner

public void addCurrentPartner(Person p)
adds the given sexual partner

Parameters:
p - the new sexual partner

removeCurrentPartner

public void removeCurrentPartner(Person p)
removes the given sexual partner

Parameters:
p - sexual partner to be removed

updatePartnerDuration

private void updatePartnerDuration(Person p)
internal helper function: updates the partner duration for the given partner


updatePartnerDuration

private void updatePartnerDuration(Person p,
                                   int duration)
internal helper function: update recorded data about partnership duration


removeCurrentPartners

public void removeCurrentPartners()
removes all current sexual partners


isHIVPositive

protected boolean isHIVPositive()
returns if this agent has contracted HIV

Returns:
true if the agent is HIV-positive, false otherwise

hasAIDS

protected boolean hasAIDS()
returns if this agent has developed AIDS

Returns:
true if the agent has AIDS, false otherwise

getFriends

protected java.util.ArrayList<Person> getFriends()
returns this agent's friends

Returns:
list of friends

getKin

protected java.util.ArrayList<Person> getKin()
retrieves relatives in other households (from kinship network)

Returns:
list of relatives in households other than own

getNumKinHouseholds

protected int getNumKinHouseholds()
returns the number of kin households, i.e. the number of households this agent's household maintains a kinship link with

Returns:
number of kin households

toString

public java.lang.String toString()
returns a String representation of this person.

Overrides:
toString in class java.lang.Object
Returns:
this agent's name

assertNeighbourEndorsement

public void assertNeighbourEndorsement(Person neighbour)
endorse the given neighbour, i.e. assert a new endorsed fact with endorsement "is-neighbour" for this agent

Parameters:
neighbour - the neighbour

assertSameClubEndorsement

public void assertSameClubEndorsement(Person fellowMember)
endorse the given fellow club member, i.e assert a new endorsed fact with endorsement "same-club"

Parameters:
fellowMember - the fellow club member

removeSameClubEndorsement

public void removeSameClubEndorsement(Person fellowMember)
un-endorse the given fellow club member, i.e retract the endorsed fact with endorsement "same-club" for this agent

Parameters:
fellowMember - the fellow club member