package uk.ac.leeds.sog.moses.agent; import java.util.ArrayList; import java.util.List; /** * @author Belinda *This class provides the constructor for all kinds of people. *All general attributes were defined here and general methods *to get those attributes are provided here. Any type of the people *that form the households can be created in the sub-classes of this *class and they can inherit all methods from this class. */ public abstract class Person implements java.io.Serializable,Comparable { // person ID protected int i_pid; // age protected int i_age; // social class category protected String i_socialClass; // gender: 1:M or 2:F protected int i_gender; // marital status: 1:Y(married) or 0:N(not married) protected int i_maritalStatus; //With long term illness? 1:Y, 0:N protected int i_intIllness; //Health Statues 1(Good), 2(Fairly good), 3(Not good) protected int i_health; //Location at the ward level: 1-32? protected String i_wLocation; //Location at the output area level:1-?? protected String i_oLocation; // Is a HRP? Y(1), N(0) protected int i_hrpStatus; // Household ID protected int i_householdID; //Family size: number of people in household (include single households) protected int i_householdSize; //Is a carer? 1:Y 0:N protected int i_career; //In formal care? 1:Y, 0:N protected int i_formalCare; // is dead? 1:Y, 0:N protected int i_deathStatus; //number of elderly dependent protected int i_numElderlyDependent; // number of elderly including elderly protected int i_numElderly; // has child dependent? Y(1),N(0) protected int i_hasChildDependent; // number of child dependent protected int i_numChildDependent; // number of child dependent protected int i_numAdultDependent; // IndividualSARRecordID protected int i_indSARRecID; // id protected int i_id; // Fitness indicator: for the Generic Algorithm used to generate the raw data protected String i_fitness; // Location(Output Area Zone_Code) protected String i_location; // role change history in a person's lifecycle sucha as child --> adult --> elderly private List i_roleHistory; private static String s_lineSeparator = System.getProperty("line.separator"); //constructor to construct a person public Person(int a_pid) { i_pid = a_pid; i_deathStatus = 0; i_roleHistory = new ArrayList(); } //Methods to get and set the attributes defined above for a person public int getPid() { return i_pid; } public void setPid(int a_pid) { i_pid = a_pid; } public int getHouseID() { return i_householdID; } public void setHouseID(int a_hid) { i_householdID = a_hid; } public int getHrpStatus() { return i_hrpStatus; } public void setHrpStatus(int a_hrpStatus) { i_hrpStatus = a_hrpStatus; } public int getAge() { return i_age; } public void setAge(int an_age) { i_age = an_age; } public void addAge(int increasement) { i_age += increasement; } public String getSocialClass() { return i_socialClass; } public void setSocialClass(String a_socialClass) { i_socialClass = a_socialClass; } public int getGender() { return i_gender; } public void setGender(int a_gender) { i_gender = a_gender; } public int getMaritalStatus() { return i_maritalStatus; } public void setMaritalStatus(int a_maritalStatus) { i_maritalStatus = a_maritalStatus; } public int getCarer() { return i_career; } public void setCarer(int a_career) { i_career = a_career; } public int getHealth() { return i_health; } public void setHealth(int a_health) { i_health = a_health; } public int getIntIllness() { return i_intIllness; } public void setIntIllness(int an_intIllness) { i_intIllness = an_intIllness; } public int getFormalCare() { return i_formalCare; } public void setFormalCare(int a_formalCare) { i_formalCare = a_formalCare; } public int getDeathStatus() { return i_deathStatus; } public void setDeathStatus(int a_deathStatus) { i_deathStatus = a_deathStatus; } public int getNumElderlyDependent() { return i_numElderlyDependent; } public void setNumElderlyDependent(int a_numElderlyDependent) { i_numElderlyDependent = a_numElderlyDependent; } public int getNumElderly() { return i_numElderly; } public void setNumElderly(int a_numElderl) { i_numElderly = a_numElderl; } public int getNumChildDependent() { return i_numChildDependent; } public void setNumChildDependent(int a_numChildDependent) { i_numChildDependent = a_numChildDependent; } public void setNumAdultDependent(int a_numAdultDependent) { i_numAdultDependent = a_numAdultDependent; } public int getNumAdultDependent() { return i_numAdultDependent; } public int getChildDependentFlag() { return i_hasChildDependent; } public void setChildDependentFlag(int a_childDependentFlag) { i_hasChildDependent = a_childDependentFlag; } public int getHouseholdSize() { return i_householdSize; } public void setHouseholdSize(int a_householdSize) { i_householdSize = a_householdSize; } public String getWLocation() { return i_wLocation; } public void setWLocation(String a_location) { i_wLocation = a_location; } public String getOLocation() { return i_oLocation; } public void setOLocation(String a_location) { i_oLocation = a_location; } public int getId() { return i_id; } public void setId(int an_id) { i_id = an_id; } public int getIndSARRecID() { return i_indSARRecID; } public void setIndSARRecID(int an_id) { i_indSARRecID = an_id; } // public String getFitness() { return i_fitness; } public void setFitness(String a_fitness) { i_fitness = a_fitness; } public String getLocation() { return i_location; } public void setLocation(String a_location) { i_location = a_location; } public void addRole(String a_rolename) { i_roleHistory.add(a_rolename); } public List getRoleHistory() { return i_roleHistory; } public int compareTo(Object object) { Person another = (Person) object; if(i_age < another.getAge()) { return -1; } else if( i_age == another.getAge()) { return 0; } else { return 1; } } //method to advance one step in the model public abstract void step(); //method to get the string with the variable names public String toString() { StringBuffer buff = new StringBuffer(); buff.append("pid=" + i_pid); buff.append(" hid=" + i_householdID); buff.append(" hrp=" + i_hrpStatus); buff.append(" age=" + i_age); buff.append(" social_class=" + i_socialClass); buff.append(" gender=" + i_gender); buff.append(" marital_status=" + i_maritalStatus); buff.append(" career=" + i_career); buff.append(" health=" + i_health); buff.append(" int_illness=" + i_intIllness); buff.append(" formal_care=" + i_formalCare); buff.append(" death_status=" + i_deathStatus); buff.append(" number_of_elderly_dependent=" + i_numElderlyDependent); buff.append(" number_of_elderly=" + i_numElderly); buff.append(" child_dependent_flag=" + i_hasChildDependent); buff.append(" number_of_child_dependent=" + i_numChildDependent); buff.append(" number_of_adult_dependent=" + i_numAdultDependent); buff.append(" household_size=" + i_householdSize); buff.append(" wLocation=" + i_wLocation); buff.append(" oLocatiobn=" + i_oLocation); buff.append(" Locatiobn=" + i_location); buff.append(" id=" + i_id); buff.append(" IndividualSARRecordID=" + i_indSARRecID); buff.append(" Fitness=" + i_fitness); buff.append(s_lineSeparator); return buff.toString(); } }