Class CSVOutputFormatter

    • Constructor Detail

      • CSVOutputFormatter

        public CSVOutputFormatter​(IdGroupingToken groupId)
                           throws PlanItException
        Base constructor
        Parameters:
        groupId - contiguous id generation within this group for instances of this class
        Throws:
        PlanItException - thrown if there is an error
    • Method Detail

      • writeLinkResultsForCurrentTimePeriod

        protected void writeLinkResultsForCurrentTimePeriod​(OutputConfiguration outputConfiguration,
                                                            OutputTypeConfiguration outputTypeConfiguration,
                                                            OutputTypeEnum currentOutputType,
                                                            OutputAdapter outputAdapter,
                                                            Set<Mode> modes,
                                                            TimePeriod timePeriod,
                                                            int iterationIndex)
                                                     throws PlanItException
        Write link results for the current time period to the CSV file
        Specified by:
        writeLinkResultsForCurrentTimePeriod in class BaseOutputFormatter
        Parameters:
        outputConfiguration - output configuration
        outputTypeConfiguration - OutputTypeConfiguration for current persistence
        currentOutputType - active OutputTypeEnum of the configuration we are persisting for (can be a SubOutputTypeEnum or an OutputType)
        outputAdapter - OutputAdapter for current persistence
        modes - Set of modes of travel
        timePeriod - current time period
        iterationIndex - current iteration index
        Throws:
        PlanItException - thrown if there is an error
      • writeOdResultsForCurrentTimePeriod

        protected void writeOdResultsForCurrentTimePeriod​(OutputConfiguration outputConfiguration,
                                                          OutputTypeConfiguration outputTypeConfiguration,
                                                          OutputTypeEnum currentOutputType,
                                                          OutputAdapter outputAdapter,
                                                          Set<Mode> modes,
                                                          TimePeriod timePeriod,
                                                          int iterationIndex)
                                                   throws PlanItException
        Write Origin-Destination results for the time period to the CSV file
        Specified by:
        writeOdResultsForCurrentTimePeriod in class BaseOutputFormatter
        Parameters:
        outputConfiguration - output configuration
        outputTypeConfiguration - OutputTypeConfiguration for current persistence
        currentOutputType - active OutputTypeEnum of the configuration we are persisting for (can be a SubOutputTypeEnum or an OutputType)
        outputAdapter - OutputAdapter for current persistence
        modes - Set of modes of travel
        timePeriod - current time period
        iterationIndex - current iteration index
        Throws:
        PlanItException - thrown if there is an error
      • writePathResultsForCurrentTimePeriod

        protected void writePathResultsForCurrentTimePeriod​(OutputConfiguration outputConfiguration,
                                                            OutputTypeConfiguration outputTypeConfiguration,
                                                            OutputTypeEnum currentOutputType,
                                                            OutputAdapter outputAdapter,
                                                            Set<Mode> modes,
                                                            TimePeriod timePeriod,
                                                            int iterationIndex)
                                                     throws PlanItException
        Write Path results for the time period to the CSV file
        Specified by:
        writePathResultsForCurrentTimePeriod in class BaseOutputFormatter
        Parameters:
        outputConfiguration - output configuration
        outputTypeConfiguration - OutputTypeConfiguration for current persistence
        currentOutputType - active OutputTypeEnum of the configuration we are persisting for (can be a SubOutputTypeEnum or an OutputType)
        outputAdapter - OutputAdapter for current persistence
        modes - Set of modes of travel
        timePeriod - current time period
        iterationIndex - current iteration index
        Throws:
        PlanItException - thrown if there is an error
      • writeGeneralResultsForCurrentTimePeriod

        protected void writeGeneralResultsForCurrentTimePeriod​(OutputConfiguration outputConfiguration,
                                                               OutputTypeConfiguration outputTypeConfiguration,
                                                               OutputTypeEnum currentOutputType,
                                                               OutputAdapter outputAdapter,
                                                               Set<Mode> modes,
                                                               TimePeriod timePeriod,
                                                               int iterationIndex)
                                                        throws PlanItException
        Write General results for the current time period to the CSV file
        Specified by:
        writeGeneralResultsForCurrentTimePeriod in class BaseOutputFormatter
        Parameters:
        outputConfiguration - output configuration
        outputTypeConfiguration - OutputTypeConfiguration for current persistence
        currentOutputType - active OutputTypeEnum of the configuration we are persisting for (can be a SubOutputTypeEnum or an OutputType)
        outputAdapter - OutputAdapter for current persistence
        modes - Set of modes of travel
        timePeriod - current time period
        iterationIndex - current iteration index
        Throws:
        PlanItException - thrown if there is an error
      • writeSimulationResultsForCurrentTimePeriod

        protected void writeSimulationResultsForCurrentTimePeriod​(OutputConfiguration outputConfiguration,
                                                                  OutputTypeConfiguration outputTypeConfiguration,
                                                                  OutputTypeEnum currentOutputType,
                                                                  OutputAdapter outputAdapter,
                                                                  Set<Mode> modes,
                                                                  TimePeriod timePeriod,
                                                                  int iterationIndex)
                                                           throws PlanItException
        Write Simulation results for the current time period to the CSV file
        Specified by:
        writeSimulationResultsForCurrentTimePeriod in class BaseOutputFormatter
        Parameters:
        outputConfiguration - output configuration
        outputTypeConfiguration - OutputTypeConfiguration for current persistence
        currentOutputType - active OutputTypeEnum of the configuration we are persisting for (can be a SubOutputTypeEnum or an OutputType)
        outputAdapter - OutputAdapter for current persistence
        modes - Set of modes of travel
        timePeriod - current time period
        iterationIndex - current iteration index
        Throws:
        PlanItException - thrown if there is an error
      • initialiseBeforeSimulation

        public void initialiseBeforeSimulation​(OutputConfiguration outputConfiguration,
                                               long runId)
                                        throws PlanItException
        Open output CSV file for specified output type configuration. This method also creates the output file directory if it does not already exist.
        Specified by:
        initialiseBeforeSimulation in interface OutputFormatter
        Parameters:
        outputConfiguration - OutputConfiguration of the assignment
        runId - the id number of the run
        Throws:
        PlanItException - thrown if output file or directory cannot be opened
      • setCsvDirectory

        public void setCsvDirectory​(String csvOutputDirectory)
        Sets the name of the CSAV output file directory
        Specified by:
        setCsvDirectory in interface CsvTextFileOutputFormatter
        Parameters:
        csvOutputDirectory - the name of the output file directory
      • setCsvNameExtension

        public void setCsvNameExtension​(String csvNameExtension)
        Sets the extension of the CSV output file
        Specified by:
        setCsvNameExtension in interface CsvTextFileOutputFormatter
        Parameters:
        csvNameExtension - the extension of the CSV output file
      • setCsvNameRoot

        public void setCsvNameRoot​(String csvNameRoot)
        Sets the root name of the CSV output file
        Specified by:
        setCsvNameRoot in interface CsvTextFileOutputFormatter
        Parameters:
        csvNameRoot - root name of CSV output file
      • getCsvFileName

        public List<String> getCsvFileName​(OutputType outputType)
        Returns the name of the CSV output file for a specified output type
        Specified by:
        getCsvFileName in interface CsvTextFileOutputFormatter
        Parameters:
        outputType - the specified output type
        Returns:
        the name of the output file
      • canHandleMultipleIterations

        public boolean canHandleMultipleIterations()
        Flag to indicate whether an implementation can handle multiple iterations If this returns false, acts as though OutputConfiguration.setPersistOnlyFinalIteration() is set to true
        Specified by:
        canHandleMultipleIterations in interface OutputFormatter
        Returns:
        flag to indicate whether the OutputFormatter can handle multiple iterations