My Project
Developer Guide

Structure of Domain Elements

The project includes basic building blocks for a transit system including buses, passengers, stops and routes located in src directory They are corresponding to 4 classes.

Passenger

Passenger has attributes of his name, waiting time including that at stop and on bus and the id of his destination stop. Functions in this class can change the status of passenger.

Stop

Stop have its own id, list of passenger waiting at the stop, and its location information. Methods in this class enables to load passenger on bus when a bus arrives.

Bus

Each Bus object having 2 routes indicating an entire circulatory route. It also has a list of passengers on the bus, its speed and capacity. When stops try to load passenger on the bus, the bus will check if it is doable by checking if the bus is full. Buses move and update it's position based on the speed and distance to the next stop.

Route

Route is constructed by a list of stops. It keeps track on next stops of the bus and provides it with distance information.

Structure of Simulation Elements

To simulate the transit system according to the realiistic situation, the project is also having components contributing to simulation. They are located in src directory.

Passenger factory

There are 2 versions of passenger factory. PassengerFactory is a class that generate randomized name for passengers while DPassengerFactory generate deterministic name that used for regression tests.

Passenger generator

There are 2 versions of passenger generators as well. RandomPassengerGenerator generate passengers at stops based on the probability of occurance at each stop. RtestPassengerGenerator however, generate the number of passengers at each stop based on the stop id. It is also used for regression test.

configuration manager

ConfigManager is a class that reads from users specified text file and generate busses, routes and stops based on the given information.

Simulators

Located in src directory.

LocalSimulator

It is basically imitating the transit system by creating instances of those classes and implement by logical process.

rLocalSimulator

It stortens the stops in eastbound and eastbound into 3 respectively, so the driver runs faster. Used for regression test.

ConfigSimulator

A simulator that runs the simulation given the specified busses, routes and stops.

Drivers

There are many drivers in the drivers directory of the project.

Drivers

Those are the drivers of the tests on domain elements and simulation elements of the project including busses, routes, passengers, stops, passenger factory and passenger generators.

Test Driver

File named regression_driver is to drive the regression test.

Simulation Drivers

There are 2 versions of simple transit simulation. The version in transit_sim.cc outputs the simulation process to the standard outstream while capture_transit_sim outputs the results to a specified file.