RailStationDemand

public class RailStationDemand

This class stores passenger rail demand = station usage data (entries + exists).

Author:Milan Lovric

Constructors

RailStationDemand

public RailStationDemand(String fileName)

RailStationDemand

public RailStationDemand(List<String> header)

Constructor for empty rail station demand.

Parameters:
  • header

Methods

addStation

public void addStation(RailStation station)

Add a rail station data to the rail demand (overwrites existing one).

Parameters:
  • station

calculateDailyZonalUsageAverage

public HashMap<String, Double> calculateDailyZonalUsageAverage()

Calculates daily zonal usage (the average for all stations within LAD).

Returns:Daily zonal usage per station.

calculateDailyZonalUsageTotal

public HashMap<String, Double> calculateDailyZonalUsageTotal()

Calculates daily zonal usage (the sum for all stations within LAD).

Returns:Daily zonal usage.

calculateYearlyZonalUsageAverage

public HashMap<String, Integer> calculateYearlyZonalUsageAverage()

Calculates yearly zonal usage (the average for all stations within LAD).

Returns:Yearly zonal usage per station.

calculateYearlyZonalUsageTotal

public HashMap<String, Integer> calculateYearlyZonalUsageTotal()

Calculates yearly zonal usage (the sum for all stations within LAD).

Returns:Yearly zonal usage.

createListOfStationsWithinEachLAD

public HashMap<String, List<RailStation>> createListOfStationsWithinEachLAD()

Creates a list of stations within each LAD.

Returns:List of stations within each LAD.

getHeader

public List<String> getHeader()

Getter method for the header.

Returns:header

getRailDemandList

public List<RailStation> getRailDemandList()

Getter method for the rail demand list.

Returns:Rail demand list

getRailDemandMap

public Map<Integer, RailStation> getRailDemandMap()

Getter method for the rail demand map.

Returns:Rail demand map.

printRailDemand

public void printRailDemand(String message)

Print rail demand.

Parameters:
  • message – Message to print before the demand.

printRailDemandNLCSorted

public void printRailDemandNLCSorted(String message)

Print rail demand sorted on NLC.

Parameters:
  • message – Message to print before the demand.

printRailDemandNameSorted

public void printRailDemandNameSorted(String message)

Print rail demand sorted on station name.

Parameters:
  • message – Message to print before the demand.

printRailDemandUsageSorted

public void printRailDemandUsageSorted(String message)

Print rail demand sorted on station usage.

Parameters:
  • message – Message to print before the demand.

removeStation

public boolean removeStation(int NLC)

Remove station with a given NLC code.

Parameters:
  • NLC – Station code.
Returns:

true if station existed in demand and was successfully removed.

saveRailStationDemand

public void saveRailStationDemand(int year, String outputFile)

Saves rail station demand to an output file.

Parameters:
  • year – Year of the data.
  • outputFile – Output file name (with path).

saveZonalRailStationDemand

public void saveZonalRailStationDemand(int year, String outputFile)

Saves zonal rail station demand to an output file.

Parameters:
  • year – Year of the data.
  • outputFile – Output file name (with path).

sortStationsOnNLC

public void sortStationsOnNLC()

Sorts stations on NLC in an ascending order.

sortStationsOnName

public void sortStationsOnName()

Sorts stations on station name in an ascending order.

sortStationsOnUsage

public void sortStationsOnUsage()

Sorts stations on usage in a descending order.