SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00009 // Parent object of every person, contains age and any natural characteristic 00010 /****************************************************************************/ 00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00013 // activitygen module 00014 // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) 00015 /****************************************************************************/ 00016 // 00017 // This file is part of SUMO. 00018 // SUMO is free software: you can redistribute it and/or modify 00019 // it under the terms of the GNU General Public License as published by 00020 // the Free Software Foundation, either version 3 of the License, or 00021 // (at your option) any later version. 00022 // 00023 /****************************************************************************/ 00024 00025 00026 // =========================================================================== 00027 // included modules 00028 // =========================================================================== 00029 #ifdef _MSC_VER 00030 #include <windows_config.h> 00031 #else 00032 #include <config.h> 00033 #endif 00034 00035 #include "AGPerson.h" 00036 #include <utils/common/RandHelper.h> 00037 #include <iostream> 00038 00039 00040 // =========================================================================== 00041 // used namespaces 00042 // =========================================================================== 00043 using namespace std; 00044 00045 00046 // =========================================================================== 00047 // method definitions 00048 // =========================================================================== 00049 AGPerson::AGPerson(int age) : age(age) {} 00050 00051 /****************************************************************************/ 00052 00053 AGPerson::~AGPerson() {} 00054 00055 /****************************************************************************/ 00056 00057 void 00058 AGPerson::print() const { 00059 cout << "- Person: Age=" << age << endl; 00060 } 00061 00062 /****************************************************************************/ 00063 00064 int 00065 AGPerson::getAge() const { 00066 return age; 00067 } 00068 00069 /****************************************************************************/ 00070 00071 bool 00072 AGPerson::decide(SUMOReal proba) const { 00073 return (RandHelper::rand(1000) < static_cast<int>(1000.0f * proba)); 00074 } 00075 00076 /****************************************************************************/