Package trace

Class TraceGenerationEngine


  • public class TraceGenerationEngine
    extends java.lang.Object
    This class is reponsible for generating the user traces using data from the ParserEngine.
    • Field Detail

      • allUBahnStations

        java.util.ArrayList<Station> allUBahnStations
      • stopsWithSchedule

        java.util.Map<java.lang.Long,​java.util.ArrayList<ScheduleItem>> stopsWithSchedule
      • total_users

        int total_users
      • total_ticks

        int total_ticks
    • Constructor Detail

      • TraceGenerationEngine

        public TraceGenerationEngine​(ParserEngine parserEngine)
      • TraceGenerationEngine

        public TraceGenerationEngine()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • getTotal_users

        public int getTotal_users()
      • getTotal_ticks

        public int getTotal_ticks()
      • _getConfigValue

        private java.lang.String _getConfigValue​(java.lang.String key)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • getStates

        public java.util.List<State> getStates()
                                        throws java.io.IOException
        Returns the list of states for all the ticks and users in the simulation as specified in config.properties
        Throws:
        java.io.IOException
      • getNextScheduleItem

        private ScheduleItem getNextScheduleItem​(java.util.ArrayList<ScheduleItem> scheduleItems,
                                                 int tick,
                                                 java.lang.Long previousStation)
                                          throws java.io.IOException
        Contains logic for calculating the next train to board given a list of trains leaving from the current station
        Parameters:
        scheduleItems - A list of all trains departing from a given station throughout the day
        tick - The current tick for which we require a departing train
        previousStation - The station from which the user just arrived, to avoid the case where the user goes back to the same station
        Returns:
        ScheduleItem One element of the scheduleItems based on the logic of the function
        Throws:
        java.io.IOException
      • getAbsoluteTimeFromTick

        public int getAbsoluteTimeFromTick​(java.lang.String startTime,
                                           int tick)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • loadInitialPopulationValues

        private void loadInitialPopulationValues()
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • getStartStation

        private Station getStartStation()
                                 throws java.io.IOException
        Contains logic to select the start station based on the "popularity score" of each station as specified in config.properties
        Throws:
        java.io.IOException
      • setConfigurationChangedListener

        public void setConfigurationChangedListener​(ConfigurationChangedListener configurationChangedListener)