Package org.goplanit.output.adapter
Class OutputTypeAdapterImpl
- java.lang.Object
-
- org.goplanit.output.adapter.OutputTypeAdapterImpl
-
- All Implemented Interfaces:
OutputTypeAdapter
- Direct Known Subclasses:
OdOutputTypeAdapterImpl
,PathOutputTypeAdapterImpl
,PhysicalLinkOutputTypeAdapterImpl
,UntypedLinkOutputTypeAdapterImpl
public abstract class OutputTypeAdapterImpl extends Object implements OutputTypeAdapter
Top-level abstract class which defines the common methods required by all output type adapters- Author:
- gman6028
-
-
Field Summary
Fields Modifier and Type Field Description protected OutputType
outputType
The OutputType this OutputTypeAdapter is used for
-
Constructor Summary
Constructors Constructor Description OutputTypeAdapterImpl(OutputType outputType, TrafficAssignment trafficAssignment)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static Optional<?>
createConvertedUnitsValue(OutputProperty outputProperty, Optional<?> unconvertedValue)
Convert the output property value that is assumed to be in the properties default units in the desired units indicated on the propertyprotected TrafficAssignment
getAssignment()
Access the assignmentOptional<Integer>
getIterationIndexForSubOutputType(SubOutputTypeEnum outputTypeEnum)
Default implementation assumes that regular iteration index is used, which in most cases it true, only when for example costs are trailing one iteration behind in case they are only revealed in the next iteration this method should be overriddenOutputType
getOutputType()
Return the output type corresponding to this output adapterprotected Optional<?>
getOutputTypeIndependentPropertyValue(OutputProperty outputProperty, Mode mode, TimePeriod timePeriod)
Returns the value of properties which are common to all output type adapters
-
-
-
Field Detail
-
outputType
protected OutputType outputType
The OutputType this OutputTypeAdapter is used for
-
-
Constructor Detail
-
OutputTypeAdapterImpl
public OutputTypeAdapterImpl(OutputType outputType, TrafficAssignment trafficAssignment)
Constructor- Parameters:
outputType
- the OutputType this adapter corresponds totrafficAssignment
- TrafficAssignment object which this adapter wraps
-
-
Method Detail
-
getAssignment
protected TrafficAssignment getAssignment()
Access the assignment- Returns:
- the assignment
-
createConvertedUnitsValue
protected static Optional<?> createConvertedUnitsValue(OutputProperty outputProperty, Optional<?> unconvertedValue) throws PlanItException
Convert the output property value that is assumed to be in the properties default units in the desired units indicated on the property- Parameters:
outputProperty
- to base conversion onunconvertedValue
- original value in default units- Returns:
- converted value as optional
- Throws:
PlanItException
- thrown if error
-
getOutputTypeIndependentPropertyValue
protected Optional<?> getOutputTypeIndependentPropertyValue(OutputProperty outputProperty, Mode mode, TimePeriod timePeriod)
Returns the value of properties which are common to all output type adapters- Parameters:
outputProperty
- the specified output propertymode
- the current modetimePeriod
- the current time period- Returns:
- the value of the specified property, or null if the specified property is not common to all output adapters (or an Exception message if an error has occurred)
-
getOutputType
public OutputType getOutputType()
Return the output type corresponding to this output adapter- Specified by:
getOutputType
in interfaceOutputTypeAdapter
- Returns:
- the output type corresponding to this output adapter
-
getIterationIndexForSubOutputType
public Optional<Integer> getIterationIndexForSubOutputType(SubOutputTypeEnum outputTypeEnum) throws PlanItException
Default implementation assumes that regular iteration index is used, which in most cases it true, only when for example costs are trailing one iteration behind in case they are only revealed in the next iteration this method should be overridden- Specified by:
getIterationIndexForSubOutputType
in interfaceOutputTypeAdapter
- Parameters:
outputTypeEnum
- , allowed to be null, in that case it is assumed there does not exist a suboutputtype for this output type- Returns:
- iterationIndexForData
- Throws:
PlanItException
- thrown if exception
-
-