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