Class BaseOutputFormatter

    • Field Detail

      • outputKeyProperties

        protected Map<OutputType,​OutputProperty[]> outputKeyProperties
        Map of OutputProperty types of keys for each OutputType
      • outputValueProperties

        protected Map<OutputType,​OutputProperty[]> outputValueProperties
        Map of OutputProperty types for values for each OutputType
      • outputTypeValuesLocked

        protected Map<OutputType,​Boolean> outputTypeValuesLocked
        Map to store whether any data values have been stored for a given output type. If data have been stored for an output type, it is "locked" so its key and output properties cannot be reset
      • outputTypeKeysLocked

        protected Map<OutputType,​Boolean> outputTypeKeysLocked
        Map to store which output types are already in use as keys
      • id

        protected long id
        Unique internal id of the output writer
      • outputTimeUnit

        protected OutputTimeUnit outputTimeUnit
        Time unit to be used in outputs
      • outputTypes

        protected Set<OutputType> outputTypes
        List of registered OutputTypes
      • initialCostsLocation

        protected String initialCostsLocation
        The location of the initial costs files
    • Constructor Detail

      • BaseOutputFormatter

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

      • lockOutputProperties

        protected void lockOutputProperties​(OutputType outputType)
        Lock the output keys and values for a specified output type
        Parameters:
        outputType - the output type to be locked
      • writeLinkResultsForCurrentTimePeriod

        protected abstract 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
        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 abstract 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
        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 abstract 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
        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 abstract 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
        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 abstract void writePathResultsForCurrentTimePeriod​(OutputConfiguration outputConfiguration,
                                                                     OutputTypeConfiguration outputTypeConfiguration,
                                                                     OutputTypeEnum currentOutputType,
                                                                     OutputAdapter outputAdapter,
                                                                     Set<Mode> modes,
                                                                     TimePeriod timePeriod,
                                                                     int iterationIndex)
                                                              throws PlanItException
        Write OD Path results for the time period to the CSV file
        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
      • getId

        public long getId()
        Description copied from interface: OutputFormatter
        Collect the id of the formatter
        Specified by:
        getId in interface OutputFormatter
        Returns:
        id
      • getOutputTimeUnit

        public OutputTimeUnit getOutputTimeUnit()
        Returns the current time units
        Returns:
        the current time units
      • setOutputTimeUnit

        public void setOutputTimeUnit​(OutputTimeUnit outputTimeUnit)
        Sets the current time units
        Parameters:
        outputTimeUnit - the specified time units
      • getOutputTimeUnitString

        public String getOutputTimeUnitString()
        Returns the current time units as a String
        Returns:
        the current time units as a String