SUMO - Simulation of Urban MObility
AGSchool.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 // activitygen module
5 // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)
6 /****************************************************************************/
7 //
8 // This program and the accompanying materials
9 // are made available under the terms of the Eclipse Public License v2.0
10 // which accompanies this distribution, and is available at
11 // http://www.eclipse.org/legal/epl-v20.html
12 //
13 /****************************************************************************/
21 // Correspond to given ages and referenced by children. Has a precise location.
22 /****************************************************************************/
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <iostream>
35 #include <string>
36 #include "AGSchool.h"
37 #include "AGPosition.h"
38 
39 
40 // ===========================================================================
41 // method definitions
42 // ===========================================================================
43 void
44 AGSchool::print() const {
45  std::cout << "- school: " << " placeNbr=" << capacity << " hours=[" << opening << ";" << closing << "] ages=[" << beginAge << ";" << endAge << "]" << std::endl;
46 }
47 
48 int
50  return capacity;
51 }
52 
53 bool
55  if (capacity > 0) {
56  --capacity;
57  return true;
58  }
59  return false;
60 }
61 
62 bool
64  if (capacity < initCapacity) {
65  ++capacity;
66  return true;
67  }
68  return false;
69 }
70 
71 bool
73  if (age <= endAge && age >= beginAge) {
74  return true;
75  }
76  return false;
77 }
78 
79 int
81  return beginAge;
82 }
83 
84 int
86  return endAge;
87 }
88 
91  return location;
92 }
93 
94 int
96  return closing;
97 }
98 
99 int
101  return opening;
102 }
103 
104 /****************************************************************************/
int capacity
Definition: AGSchool.h:66
void print() const
Definition: AGSchool.cpp:44
int endAge
Definition: AGSchool.h:65
A location in the 2D plane freely positioned on a street.
Definition: AGPosition.h:62
bool addNewChild()
Definition: AGSchool.cpp:54
int closing
Definition: AGSchool.h:69
AGPosition getPosition()
Definition: AGSchool.cpp:90
int opening
Definition: AGSchool.h:69
bool acceptThisAge(int age)
Definition: AGSchool.cpp:72
AGPosition location
Definition: AGSchool.h:68
int getEndAge()
Definition: AGSchool.cpp:85
bool removeChild()
Definition: AGSchool.cpp:63
int getOpeningHour()
Definition: AGSchool.cpp:100
int getBeginAge()
Definition: AGSchool.cpp:80
int getClosingHour()
Definition: AGSchool.cpp:95
int getPlaces()
Definition: AGSchool.cpp:49
int initCapacity
Definition: AGSchool.h:67
int beginAge
Definition: AGSchool.h:65