Package org.planit.output
Class OutputManager
- java.lang.Object
-
- org.planit.output.OutputManager
-
public class OutputManager extends Object
Base class for output writers containing basic functionality regarding all things output- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description OutputManager()Base constructor of Output writer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OutputTypeConfigurationcreateAndRegisterOutputTypeConfiguration(OutputType outputType)Factory method to create an output configuration for a given typevoidderegisterOutputTypeAdapter(OutputType outputType)Deregister the output adapter for a specified output type (if it exists)voidderegisterOutputTypeConfiguration(OutputType outputType)Remove the output type configuration for a specified output typevoidfinaliseAfterSimulation()Allows the output manager to finalise itself and any of its registered output formatters to after the simulation endedOutputConfigurationgetOutputConfiguration()Get the OutputConfiguration objectList<OutputFormatter>getOutputFormatters()Returns the list of currently registered OutputFormatter objects for a specified output typeOutputTypeConfigurationgetOutputTypeConfiguration(OutputType outputType)Collect the output type configuration for the given typeCollection<OutputTypeConfiguration>getRegisteredOutputTypeConfigurations()Returns a List of registered output type configuration objectsSet<OutputType>getRegisteredOutputTypes()Returns a List of registered output typesvoidinitialiseBeforeSimulation(long runId)Allows the output manager to initialize itself and any of its registered output formatters to prepare before the simulation startsvoidinitialiseOutputAdapters(TrafficAssignment trafficAssignment)Based on the passed in assignment, create the necessary output adaptersbooleanisOutputTypeActive(OutputType outputType)Verify if the given output type is already activated or notvoidpersistOutputData(TimePeriod timePeriod, Set<Mode> modes, boolean converged)Persist the output data for all registered output typesvoidregisterOutputFormatter(OutputFormatter outputFormatter)Register the output formatter on the output manager.voidregisterOutputTypeAdapter(OutputTypeAdapter outputTypeAdapter)Register the OutputTypeAdapter for a given output typevoidunregisterOutputFormatter(OutputFormatter outputFormatter)Remove an output formatter which has previously been registered
-
-
-
Method Detail
-
initialiseBeforeSimulation
public void initialiseBeforeSimulation(long runId) throws PlanItExceptionAllows the output manager to initialize itself and any of its registered output formatters to prepare before the simulation starts- Parameters:
runId- traffic assignment run id- Throws:
PlanItException- thrown if there is an error
-
finaliseAfterSimulation
public void finaliseAfterSimulation() throws PlanItExceptionAllows the output manager to finalise itself and any of its registered output formatters to after the simulation ended- Throws:
PlanItException- thrown if there is an error
-
persistOutputData
public void persistOutputData(TimePeriod timePeriod, Set<Mode> modes, boolean converged) throws PlanItException
Persist the output data for all registered output types- Parameters:
timePeriod- the current time period whose results are being savedmodes- Set of modes for the current assignmentconverged- true if the assignment has converged- Throws:
PlanItException- thrown if there is an error
-
createAndRegisterOutputTypeConfiguration
public OutputTypeConfiguration createAndRegisterOutputTypeConfiguration(OutputType outputType) throws PlanItException
Factory method to create an output configuration for a given type- Parameters:
outputType- the output type to register the configuration for- Returns:
- outputTypeconfiguration the output type configuration that has been newly registered
- Throws:
PlanItException- thrown if there is an error
-
deregisterOutputTypeConfiguration
public void deregisterOutputTypeConfiguration(OutputType outputType)
Remove the output type configuration for a specified output type- Parameters:
outputType- the output type whose configuration is to be deregistered
-
registerOutputTypeAdapter
public void registerOutputTypeAdapter(OutputTypeAdapter outputTypeAdapter)
Register the OutputTypeAdapter for a given output type- Parameters:
outputTypeAdapter- the OutputTypeAdapte to be registered
-
deregisterOutputTypeAdapter
public void deregisterOutputTypeAdapter(OutputType outputType)
Deregister the output adapter for a specified output type (if it exists)- Parameters:
outputType- the output type whose adapter is to be deregistered
-
getOutputConfiguration
public OutputConfiguration getOutputConfiguration()
Get the OutputConfiguration object- Returns:
- the OutputConfiguration object being used
-
registerOutputFormatter
public void registerOutputFormatter(OutputFormatter outputFormatter)
Register the output formatter on the output manager. Whenever something is persisted it will be delegated to the registered formatters- Parameters:
outputFormatter- OutputFormatter to be registered
-
unregisterOutputFormatter
public void unregisterOutputFormatter(OutputFormatter outputFormatter)
Remove an output formatter which has previously been registered- Parameters:
outputFormatter- output formatter to be removed
-
getOutputFormatters
public List<OutputFormatter> getOutputFormatters()
Returns the list of currently registered OutputFormatter objects for a specified output type- Returns:
- List of registered OutputFormatter objects
-
isOutputTypeActive
public boolean isOutputTypeActive(OutputType outputType)
Verify if the given output type is already activated or not- Parameters:
outputType- OutputType object to be checked- Returns:
- true if active false otherwise
-
getOutputTypeConfiguration
public OutputTypeConfiguration getOutputTypeConfiguration(OutputType outputType)
Collect the output type configuration for the given type- Parameters:
outputType- OutputType to collect the output type configuration for- Returns:
- output type configuration registered, if not registered null is returned and a warning is logged
-
getRegisteredOutputTypeConfigurations
public Collection<OutputTypeConfiguration> getRegisteredOutputTypeConfigurations()
Returns a List of registered output type configuration objects- Returns:
- a List of registered output type configuration objects
-
getRegisteredOutputTypes
public Set<OutputType> getRegisteredOutputTypes()
Returns a List of registered output types- Returns:
- a List of registered output types
-
initialiseOutputAdapters
public void initialiseOutputAdapters(TrafficAssignment trafficAssignment)
Based on the passed in assignment, create the necessary output adapters- Parameters:
trafficAssignment- we are creating adapters for
-
-