Class OutputManager


  • public class OutputManager
    extends Object
    Base class for output writers containing basic functionality regarding all things output
    Author:
    markr
    • Constructor Detail

      • OutputManager

        public OutputManager​(TrafficAssignment trafficAssignment)
        Base constructor of Output writer
        Parameters:
        trafficAssignment - the traffic assignment this output manager is managing for
    • Method Detail

      • initialiseBeforeSimulation

        public void initialiseBeforeSimulation​(long runId)
                                        throws PlanItException
        Allows 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 PlanItException
        Allows 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 saved
        modes - Set of modes for the current assignment
        converged - true if the assignment has converged
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterOutputTypeConfiguration

        public OutputTypeConfiguration createAndRegisterOutputTypeConfiguration​(OutputType outputType,
                                                                                TrafficAssignment trafficAssignment)
                                                                         throws PlanItException
        Factory method to create an output configuration and adapter for a given type
        Parameters:
        outputType - the output type to register the configuration for
        trafficAssignment - traffic assignment we are creating this 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​(OutputType outputType,
                                              OutputTypeAdapter outputTypeAdapter)
        Register the OutputTypeAdapter for a given output type
        Parameters:
        outputType - the output type to register the output type adapter for
        outputTypeAdapter - the OutputTypeAdapte to be registered
      • deregisterOutputTypeAdapter

        public void deregisterOutputTypeAdapter​(OutputType outputType)
        Deregister the output adapter for a specified output type
        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 List<OutputTypeConfiguration> getRegisteredOutputTypeConfigurations()
        Returns a List of registered output type configuration objects
        Returns:
        a List of registered output type configuration objects
      • getRegisteredOutputTypes

        public List<OutputType> getRegisteredOutputTypes()
        Returns a List of registered output types
        Returns:
        a List of registered output types