|
SUMO - Simulation of Urban MObility
|
An adult person who can have a job. More...
#include <AGAdult.h>
Public Member Functions | |
| AGAdult (int age) throw () | |
| Initialises the base class and the own attributes. | |
| virtual bool | decide (SUMOReal probability) const throw () |
| Lets the person make a decision. | |
| virtual int | getAge () const throw () |
| Provides the age of the person. | |
| const AGWorkPosition & | getWorkPosition () const throw (std::runtime_error) |
| Provides the work position of the adult. | |
| bool | isWorking () const throw () |
| States whether this person occupies a work position at present. | |
| void | lostWorkPosition () throw () |
| Called when the adult has lost her job. | |
| void | print () const throw () |
| Puts out a summary of the attributes. | |
| void | resignFromWorkPosition () throw () |
| Called when the adult should resign her job. | |
| void | tryToWork (SUMOReal employmentRate, std::vector< AGWorkPosition > *wps) throw () |
| Tries to get a new work position. | |
Protected Attributes | |
| int | age |
Static Private Member Functions | |
| static AGWorkPosition * | randomFreeWorkPosition (std::vector< AGWorkPosition > *wps) throw () |
| 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 | ) | throw () |
Initialises the base class and the own attributes.
| [in] | the | age of the AGPerson |
Definition at line 55 of file AGAdult.cpp.
| bool AGPerson::decide | ( | SUMOReal | probability | ) | const throw () [virtual, inherited] |
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 69 of file AGPerson.cpp.
References RandHelper::rand().
| int AGPerson::getAge | ( | ) | const throw () [virtual, inherited] |
Provides the age of the person.
Definition at line 62 of file AGPerson.cpp.
| const AGWorkPosition & AGAdult::getWorkPosition | ( | ) | const throw (std::runtime_error) |
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 runtime exception is thrown.
| runtime_error | the adult has no work position |
Definition at line 113 of file AGAdult.cpp.
References work.
| bool AGAdult::isWorking | ( | ) | const throw () |
States whether this person occupies a work position at present.
Definition at line 90 of file AGAdult.cpp.
References work.
| void AGAdult::lostWorkPosition | ( | ) | throw () |
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 97 of file AGAdult.cpp.
References work.
Referenced by AGWorkPosition::let().
| void AGAdult::print | ( | ) | const throw () [virtual] |
Puts out a summary of the attributes.
Reimplemented from AGPerson.
Definition at line 61 of file AGAdult.cpp.
References AGPerson::age, and work.
| AGWorkPosition * AGAdult::randomFreeWorkPosition | ( | std::vector< AGWorkPosition > * | wps | ) | throw () [static, private] |
Randomly selects a free work position from the list.
| [in] | the | list of work positions (free or not) |
Definition at line 42 of file AGAdult.cpp.
References RandHelper::rand().
| void AGAdult::resignFromWorkPosition | ( | ) | throw () |
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 104 of file AGAdult.cpp.
References AGWorkPosition::let(), and work.
| void AGAdult::tryToWork | ( | SUMOReal | employmentRate, |
| std::vector< AGWorkPosition > * | wps | ||
| ) | throw () |
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 68 of file AGAdult.cpp.
References AGWorkPosition::take().
int AGPerson::age [protected, inherited] |
Definition at line 69 of file AGPerson.h.
Referenced by AGChild::alocateASchool(), AGChild::print(), and print().
AGWorkPosition* AGAdult::work [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 116 of file AGAdult.h.
Referenced by getWorkPosition(), isWorking(), lostWorkPosition(), print(), and resignFromWorkPosition().