Bug 282 - Want to get the first station in the data, got the second instead
Summary: Want to get the first station in the data, got the second instead
Status: RESOLVED FIXED
Alias: None
Product: Group 9: Route Planning
Classification: Unclassified
Component: Network (show other bugs)
Version: 1.0
Hardware: PC Mac OS
: Highest blocker
Assignee: qiyuliang2-c
URL:
: 283 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-12-09 13:01 HKT by CherineLee
Modified: 2018-12-09 13:18 HKT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description CherineLee 2018-12-09 13:01:32 HKT
Step to reproduce:
1. To set up, run
 	network = Network.getInstance();
	network.initializationStations();
	network.initializationLines();
2. To get the list of all stations, run:
        List<Station> allStations = network.getStations();
3. To get the name of the first station, run:
        String result = allStations.get(0).getName();

Expected value: Central
Actual value: Admiralty

I am not sure if this is the caused by the order of the station list or the list itself has some problem. Please check both to make sure.
Comment 1 qiyuliang2-c 2018-12-09 13:17:23 HKT
Fixed.

This is because the data file we use stores stations with ID starting from 1 instead of 0. The handling of the data file is a little bit messy and caused this problem.

Now we have decided to change the data file's index such that it starts with 0 to match the loop and everything.
Comment 2 qiyuliang2-c 2018-12-09 13:18:45 HKT
*** Bug 283 has been marked as a duplicate of this bug. ***