Eclipse SUMO - Simulation of Urban MObility
|
An adult person who can have a job. More...
#include <AGAdult.h>
Public Member Functions | |
AGAdult (int age) | |
Initialises the base class and the own attributes. | |
virtual bool | decide (double probability) const |
Lets the person make a decision. | |
virtual int | getAge () const |
Provides the age of the person. | |
const AGWorkPosition & | getWorkPosition () const |
Provides the work position of the adult. | |
bool | isWorking () const |
States whether this person occupies a work position at present. | |
void | lostWorkPosition () |
Called when the adult has lost her job. | |
void | print () const |
Puts out a summary of the attributes. | |
void | resignFromWorkPosition () |
Called when the adult should resign her job. | |
void | tryToWork (double employmentRate, std::vector< AGWorkPosition > *wps) |
Tries to get a new work position. | |
Protected Attributes | |
int | age |
Static Private Member Functions | |
static AGWorkPosition * | randomFreeWorkPosition (std::vector< AGWorkPosition > *wps) |
Randomly selects a free work position from the list. | |
Private Attributes | |
AGWorkPosition * | work |
An adult person who can have a job.
AGAdult extends AGPerson by various methods to handle work life.
AGAdult::AGAdult | ( | int | age | ) |
Initialises the base class and the own attributes.
[in] | the | age of the AGPerson |
Definition at line 52 of file AGAdult.cpp.
|
virtualinherited |
Lets the person make a decision.
The higher the degree of belief is, the more likely this method returns true.
[in] | degreeOfBelief | how strong the person beliefs the proposition |
Definition at line 54 of file AGPerson.cpp.
References RandHelper::rand().
Referenced by tryToWork().
|
virtualinherited |
Provides the age of the person.
Definition at line 48 of file AGPerson.cpp.
References AGPerson::age.
const AGWorkPosition & AGAdult::getWorkPosition | ( | ) | const |
Provides the work position of the adult.
You should test before, whether the adult has a job. If you call this method and the adult has no job, then a ProcessError is thrown.
ProcessError | the adult has no work position |
Definition at line 106 of file AGAdult.cpp.
References work.
bool AGAdult::isWorking | ( | ) | const |
States whether this person occupies a work position at present.
Definition at line 86 of file AGAdult.cpp.
References work.
void AGAdult::lostWorkPosition | ( | ) |
Called when the adult has lost her job.
This method is called from AGWorkPosition, whenever the adult lost her job, be it because it got fired or because its resignation has been accepted.
Definition at line 92 of file AGAdult.cpp.
References work.
Referenced by AGWorkPosition::let().
|
virtual |
Puts out a summary of the attributes.
Reimplemented from AGPerson.
Definition at line 57 of file AGAdult.cpp.
References AGPerson::age, and work.
|
staticprivate |
Randomly selects a free work position from the list.
[in] | the | list of work positions (free or not) |
Definition at line 38 of file AGAdult.cpp.
References RandHelper::getRandomFrom().
Referenced by tryToWork().
void AGAdult::resignFromWorkPosition | ( | ) |
Called when the adult should resign her job.
This method asks the WorkPosition to quit the job. The WorkPosition in turn calls AGAdult::lostWorkPosition.
Definition at line 98 of file AGAdult.cpp.
References AGWorkPosition::let(), and work.
void AGAdult::tryToWork | ( | double | employmentRate, |
std::vector< AGWorkPosition > * | wps | ||
) |
Tries to get a new work position.
Depending on the employment rate, this adult randomly gets unemployed or employed. If it gets employed, it randomly chooses one of the free work positions and occupies it.
The new state (employed or unemployed) is chosen independently from the previous state. If the adult was employed, her previous job is given up.
[in] |
employmentRate (1 - unemploymentRate)
[in] |
wps the list of work positions (open or not) in the city
Definition at line 63 of file AGAdult.cpp.
References AGPerson::decide(), AGWorkPosition::let(), randomFreeWorkPosition(), AGWorkPosition::take(), and work.
|
protectedinherited |
Definition at line 62 of file AGPerson.h.
Referenced by AGChild::allocateASchool(), AGPerson::getAge(), print(), AGChild::print(), and AGPerson::print().
|
private |
The work position of this adult.
A pointer to the work position or 0 if the adult is unemployed at present.
Definition at line 110 of file AGAdult.h.
Referenced by getWorkPosition(), isWorking(), lostWorkPosition(), print(), resignFromWorkPosition(), and tryToWork().