Class CsvFileOutputFormatter

    • Field Detail

      • csvFileNameMap

        protected final Map<OutputTypeEnum,​List<String>> csvFileNameMap
        Map of list of CSV output file names for each OutputType
    • Constructor Detail

      • CsvFileOutputFormatter

        protected CsvFileOutputFormatter​(IdGroupingToken groupId)
        Constructor
        Parameters:
        groupId - , contiguous id generation within this group for instances of this class
    • Method Detail

      • writeOdResultsForCurrentTimePeriodToCsvPrinter

        protected PlanItException writeOdResultsForCurrentTimePeriodToCsvPrinter​(OutputConfiguration outputConfiguration,
                                                                                 OutputTypeConfiguration outputTypeConfiguration,
                                                                                 OutputTypeEnum currentOutputType,
                                                                                 OutputAdapter outputAdapter,
                                                                                 Set<Mode> modes,
                                                                                 TimePeriod timePeriod,
                                                                                 org.apache.commons.csv.CSVPrinter csvPrinter)
        Write output values to the OD CSV file for the current iteration
        Parameters:
        outputConfiguration - output configuration
        outputTypeConfiguration - output type configuration for the current output type
        currentOutputType - the output type
        outputAdapter - output adapter for the current output type
        modes - Set of modes for the current assignment
        timePeriod - the current time period
        csvPrinter - CSVPrinter object to record results for this iteration
        Returns:
        PlanItException thrown if the CSV file cannot be created or written to
      • writePathResultsForCurrentTimePeriodToCsvPrinter

        protected PlanItException writePathResultsForCurrentTimePeriodToCsvPrinter​(OutputConfiguration outputConfiguration,
                                                                                   OutputTypeConfiguration outputTypeConfiguration,
                                                                                   OutputTypeEnum currentOutputType,
                                                                                   OutputAdapter outputAdapter,
                                                                                   Set<Mode> modes,
                                                                                   TimePeriod timePeriod,
                                                                                   org.apache.commons.csv.CSVPrinter csvPrinter)
        Write output values to the Path CSV file for the current iteration
        Parameters:
        outputConfiguration - output configuration
        outputTypeConfiguration - output type configuration for the current output type
        currentOutputType - the output type
        outputAdapter - output adapter for the current output type
        modes - Set of modes for the current assignment
        timePeriod - the current time period
        csvPrinter - CSVPrinter object to record results for this iteration
        Returns:
        PlanItException thrown if the CSV file cannot be created or written to
      • writeLinkResultsForCurrentTimePeriodToCsvPrinter

        protected PlanItException writeLinkResultsForCurrentTimePeriodToCsvPrinter​(OutputConfiguration outputConfiguration,
                                                                                   OutputTypeConfiguration outputTypeConfiguration,
                                                                                   OutputTypeEnum currentOutputType,
                                                                                   OutputAdapter outputAdapter,
                                                                                   Set<Mode> modes,
                                                                                   TimePeriod timePeriod,
                                                                                   org.apache.commons.csv.CSVPrinter csvPrinter)
        Write output values to the Link CSV file for the current iteration
        Parameters:
        outputConfiguration - output configuration
        outputTypeConfiguration - the current output type configuration
        currentOutputType - the output type
        outputAdapter - output adapter for the current output type
        modes - Set of modes for the current assignment
        timePeriod - the current time period
        csvPrinter - CSVPrinter object to record results for this iteration
        Returns:
        PlanItException thrown if the CSV file cannot be created or written to
      • openCsvFileAndWriteHeaders

        protected org.apache.commons.csv.CSVPrinter openCsvFileAndWriteHeaders​(OutputTypeConfiguration outputTypeConfiguration,
                                                                               String csvFileName)
                                                                        throws Exception
        Open the CSV output file and write the headers to it
        Parameters:
        outputTypeConfiguration - the current output type configuration
        csvFileName - the name of the CSV output file
        Returns:
        the CSVPrinter object (output values will be written to this in subsequent rows)
        Throws:
        Exception - thrown if there is an error opening the file
      • addCsvFileNamePerOutputType

        public void addCsvFileNamePerOutputType​(OutputTypeEnum currentoutputType,
                                                String csvFileName)
        Add a new name of the CSV output file for a specified output type
        Parameters:
        currentoutputType - the specified output type
        csvFileName - the name of the output file to be added