47 std::vector<AGWorkPosition*> freePos;
48 for (std::vector<AGWorkPosition>::iterator i = wps->begin(); i!= wps->end(); ++i) {
50 freePos.push_back(&*i);
53 if (freePos.empty()) {
66 std::cout <<
"- AGAdult: Age=" <<
age <<
" Work=" <<
work << std::endl;
116 throw std::runtime_error(
"AGAdult::getWorkPosition: Adult is unemployed.");
static const T & getRandomFrom(const std::vector< T > &v)
Returns a random element from the given vector.
void tryToWork(SUMOReal employmentRate, std::vector< AGWorkPosition > *wps)
Tries to get a new work position.
virtual bool decide(SUMOReal probability) const
Lets the person make a decision.
void print() const
Puts out a summary of the attributes.
void resignFromWorkPosition()
Called when the adult should resign her job.
static AGWorkPosition * randomFreeWorkPosition(std::vector< AGWorkPosition > *wps)
Randomly selects a free work position from the list.
void lostWorkPosition()
Called when the adult has lost her job.
AGAdult(int age)
Initialises the base class and the own attributes.
bool isWorking() const
States whether this person occupies a work position at present.
const AGWorkPosition & getWorkPosition() const
Provides the work position of the adult.
Base class of every person in the city (adults and children)