Package trace
Class TraceGenerationEngine
- java.lang.Object
-
- trace.TraceGenerationEngine
-
public class TraceGenerationEngine extends java.lang.ObjectThis class is reponsible for generating the user traces using data from the ParserEngine.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.ArrayList<Station>allUBahnStations(package private) ConfigurationChangedListenerconfigurationChangedListener(package private) ParserEngineparserEngine(package private) java.util.Map<java.lang.Long,java.util.ArrayList<ScheduleItem>>stopsWithSchedule(package private) inttotal_ticks(package private) inttotal_users
-
Constructor Summary
Constructors Constructor Description TraceGenerationEngine()TraceGenerationEngine(ParserEngine parserEngine)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.String_getConfigValue(java.lang.String key)intgetAbsoluteTimeFromTick(java.lang.String startTime, int tick)ConfigurationChangedListenergetConfigurationChangedListener()private ScheduleItemgetNextScheduleItem(java.util.ArrayList<ScheduleItem> scheduleItems, int tick, java.lang.Long previousStation)Contains logic for calculating the next train to board given a list of trains leaving from the current stationprivate StationgetStartStation()Contains logic to select the start station based on the "popularity score" of each station as specified in config.propertiesjava.util.List<State>getStates()Returns the list of states for all the ticks and users in the simulation as specified in config.propertiesintgetTotal_ticks()intgetTotal_users()private voidloadInitialPopulationValues()static voidmain(java.lang.String[] args)voidsetConfigurationChangedListener(ConfigurationChangedListener configurationChangedListener)
-
-
-
Field Detail
-
parserEngine
ParserEngine parserEngine
-
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
-
configurationChangedListener
ConfigurationChangedListener configurationChangedListener
-
-
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 daytick- The current tick for which we require a departing trainpreviousStation- 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
-
getConfigurationChangedListener
public ConfigurationChangedListener getConfigurationChangedListener()
-
setConfigurationChangedListener
public void setConfigurationChangedListener(ConfigurationChangedListener configurationChangedListener)
-
-