Individual
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
cpc.sau.agents
Class Individual
java.lang.Objectcpc.sau.agents.Individual
public class Individual
- extends java.lang.Object
An object representing an individual human being. It contains some basic
attributes and behaviors, and is designed to be extended and customized.
The four attributes of the individual are:
age
sex : 0 - males, 1 - female
marital status : false - single, true - married
years of education
This class offers two constructors for creating new individual agents. Set/get methods are defined to access those attributes and change their values.
| Constructor Summary | |
|---|---|
Individual()
Constructs a new individual agent with default value: age = 0, sex = 0, maritalStat = false, yearsEdu = 0. |
|
Individual(int age,
int sex,
boolean married,
int edu)
Constructs a new individual agent with user-defined values. |
|
| Method Summary | |
|---|---|
int |
getAge()
Returns this individual agent's age |
boolean |
getMaritalStat()
Returns marital status of this individual |
int |
getSex()
Returns this individual agent's sex |
int |
getYearsEdu()
Returns the years of education of this individual |
void |
setAge(int age)
Sets the age of this individual agent |
void |
setMaritalStat(boolean maritalStat)
Sets marital status of this individual agent |
void |
setSex(int sex)
Sets this individual agent's sex |
void |
setYearsEdu(int edu)
Sets the years of education of this individual |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
Individual
public Individual()
- Constructs a new individual agent with default value:
age = 0, sex = 0, maritalStat = false, yearsEdu = 0. These attributes can be changed with their set methods.
Individual
public Individual(int age,
int sex,
boolean married,
int edu)
- Constructs a new individual agent with user-defined values.
- Parameters:
age- integer value of individual's agesex- integer value of individual's sex. 0 - male, 1 - female;married- boolean value of marital status: true is married, false is singleedu- education of individual, in years
| Method Detail |
|---|
setAge
public void setAge(int age)
- Sets the age of this individual agent
- Parameters:
age- this individual agent's age
getAge
public int getAge()
- Returns this individual agent's age
- Returns:
- this individual's age
setSex
public void setSex(int sex)
- Sets this individual agent's sex
- Parameters:
sex- is an integer value, 0 - male, 1 - female
getSex
public int getSex()
- Returns this individual agent's sex
- Returns:
- this individual agent's sex, 0 - male, 1 - female
setMaritalStat
public void setMaritalStat(boolean maritalStat)
- Sets marital status of this individual agent
- Parameters:
maritalStat- a boolean value: true is married, false is single.
getMaritalStat
public boolean getMaritalStat()
- Returns marital status of this individual
- Returns:
- boolean value of individual's marital status
setYearsEdu
public void setYearsEdu(int edu)
- Sets the years of education of this individual
- Parameters:
edu- an integer value, in years
getYearsEdu
public int getYearsEdu()
- Returns the years of education of this individual
- Returns:
- integer value in years
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||

cpc.sau.agents.Individual

