-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBusPark.cpp
More file actions
48 lines (40 loc) · 840 Bytes
/
Copy pathBusPark.cpp
File metadata and controls
48 lines (40 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "BusPark.h"
#include "util.h"
#include <string_view>
using namespace std;
size_t Bus::stopCount() const
{
return route_.getStopCount();
}
size_t Bus::uniqueStopCount() const
{
return route_.getUniqueStopCount();
}
double Bus::routeLen(const Map& map) const
{
return route_.getLength(map);
}
double Bus::routeCurvature(const Map& map) const
{
return route_.getLength(map)/route_.getLengthCrowFlies(map);
}
const Route& Bus::getRoute() const
{
return route_;
}
bool BusPark::contains(const BusId& bus_id) const
{
return buses_.count(bus_id) > 0;
}
Bus* BusPark::getBus(const BusId& bus_id)
{
return contains(bus_id)
? &buses_[bus_id]
: nullptr;
}
const Bus* BusPark::getBus(const BusId& bus_id) const
{
return contains(bus_id)
? &buses_.at(bus_id)
: nullptr;
}