flu-plus-plus / bachelorproef

Bachelorproef Informatica Universiteit Antwerpen 2016–2017
Other
0 stars 4 forks source link

Create an inter-region travel model file format #25

Closed jonathanvdc closed 7 years ago

jonathanvdc commented 7 years ago

This PR's pretty boring. I created some data structures, an accompanying file format and a couple of unit tests. Additionally, I noticed and refactored a common XML file parsing pattern. That's all, I guess.

jonathanvdc commented 7 years ago

AFAICT, the std::vector in struct Airport does have a description:

/// Gets the list of all outgoing routes that start at this airport.
std::vector<AirRoute> routes;

Also, those (admittedly undocumented) fields are private. So who'd read the documentation?

Edit: My reasoning for not documenting those private fields was that doing so anyway would be redundant. The values they represent are already documented by their getters. Simply copy-pasting those doc-comments might seem like a good idea in the short term, but later the docs might diverge, which would be confusing.

/// Gets the region id for the region this data structure represents.
RegionId GetRegionId() const { return region_id; }

/// Gets the path of the population file for this region.
std::string GetRegionPopulationPath() const { return region_population_path; }

/// Gets the fraction of people in the region who travel by plane on any given day.
double GetTravelFraction() const { return travel_fraction; }

/// Gets a list of all airports.
const std::vector<AirportRef>& GetAllAirports() const { return *all_airports; }

/// Gets a list of airports in the current region.
const std::vector<AirportRef>& GetLocalAirports() const { return local_airports; }

/// Gets the set of region ids for regions that have at least one air
/// route which targets a local airport.
const std::unordered_set<RegionId>& GetRegionsWithIncomingRoutes() const
{
    return regions_with_incoming_routes;
}