Package org.goplanit.assignment
Class TrafficAssignmentConfigurator<T extends TrafficAssignment>
- java.lang.Object
-
- org.goplanit.utils.builder.Configurator<T>
-
- org.goplanit.assignment.TrafficAssignmentConfigurator<T>
-
- Type Parameters:
T
- traffic assignment type
- Direct Known Subclasses:
LtmConfigurator
,TraditionalStaticAssignmentConfigurator
public class TrafficAssignmentConfigurator<T extends TrafficAssignment> extends Configurator<T>
Configurator class for traffic assignment. Hides builder pattern from user while allowing for easy way to configure an assignment without having actual access to it.- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
logSettings
flag indicating if settings are to be logged upon building the component or notprotected static String
SET_DEMANDS
protected static String
SET_GAP_FUNCTION
protected static String
SET_INFRASTRUCTURE_NETWORK
protected static String
SET_INITIAL_LINK_SEGMENT_COST
protected static String
SET_OUTPUT_MANAGER
protected static String
SET_PHYSICAL_COST
protected static String
SET_VIRTUAL_COST
protected static String
SET_ZONING
-
Fields inherited from class org.goplanit.utils.builder.Configurator
delayedMethodCalls
-
-
Constructor Summary
Constructors Constructor Description TrafficAssignmentConfigurator(Class<T> instanceType)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OutputTypeConfiguration
activateOutput(OutputType outputType)
Method that allows one to activate specific output types for persistence on the traffic assignment instanceGapFunctionConfigurator<? extends GapFunction>
createAndRegisterGapFunction(String gapFunctionType)
Create and Register gapFunction componentPhysicalCostConfigurator<? extends AbstractPhysicalCost>
createAndRegisterPhysicalCost(String physicalTravelTimeCostFunctionType)
Create and register physical link cost function to determine travel timeSmoothingConfigurator<? extends Smoothing>
createAndRegisterSmoothing(String smoothingType)
Create and Register smoothing componentVirtualCostConfigurator<? extends AbstractVirtualCost>
createAndRegisterVirtualCost(String virtualTraveltimeCostFunctionType)
Create and Register virtual link cost function to determine travel timevoid
deactivateOutput(OutputType outputType)
Deactivate an output typeDemands
getDemands()
Get the registered demandsGapFunctionConfigurator<? extends GapFunction>
getGapFunction()
Collect the gap function of the trafficAssignment instanceLayeredNetwork<?,?>
getInfrastructureNetwork()
collect the registered networkOutputConfiguration
getOutputConfiguration()
Provide the output configuration for user accessList<OutputFormatter>
getOutputFormatters()
Returns a list of output formatters registered on this assignmentprotected OutputManager
getOutputManager()
Collect the registered output managerPhysicalCostConfigurator<? extends AbstractPhysicalCost>
getPhysicalCost()
Collect the physical cost entity registered on the traffic assignmentSmoothingConfigurator<? extends Smoothing>
getSmoothing()
Collect the smoothing entity registered on the traffic assignmentVirtualCostConfigurator<? extends AbstractVirtualCost>
getVirtualCost()
Collect the virtual cost entity registered on the traffic assignmentZoning
getZoning()
Get the registered zoningboolean
isLogSettings()
Get the flag for logging all settingsboolean
isOutputTypeActive(OutputType outputType)
Verify if a given output type is activevoid
registerInitialLinkSegmentCost(InitialMacroscopicLinkSegmentCost initialLinkSegmentCost)
Register all available initial costs, both time period agnostic and time period specific, 1:1 on the assignmentvoid
registerInitialLinkSegmentCost(InitialModesLinkSegmentCost initialLinkSegmentCost)
Register the initial link segment cost without relating it to a particular period, meaning that it is applied to all time periods that do not have a specified initial link segment costs registered for themvoid
registerInitialLinkSegmentCost(TimePeriod timePeriod, InitialModesLinkSegmentCost initialLinkSegmentCost)
Register the initial link segment cost for a specified time periodvoid
registerOutputFormatter(OutputFormatter outputFormatter)
Register an output formatterprotected void
setDemands(Demands demands)
Set the demandsprotected void
setInfrastructureNetwork(LayeredNetwork<?,?> network)
Set the networkvoid
setLogSettings(boolean flag)
Set the flag for logging all settingsprotected void
setOutputManager(OutputManager outputManager)
Set the output managerprotected void
setZoning(Zoning zoning)
Set the zoningvoid
unregisterOutputFormatter(OutputFormatter outputFormatter)
Remove an output formatter which has already been registered This is used by the Python interface, which registers the PlanItIO formatter by default-
Methods inherited from class org.goplanit.utils.builder.Configurator
callVoidMethod, collectParameterTypes, configure, getClassTypeToConfigure, getFirstParameterOfDelayedMethodCall, registerDelayedMethodCall
-
-
-
-
Field Detail
-
SET_OUTPUT_MANAGER
protected static final String SET_OUTPUT_MANAGER
- See Also:
- Constant Field Values
-
SET_GAP_FUNCTION
protected static final String SET_GAP_FUNCTION
- See Also:
- Constant Field Values
-
SET_VIRTUAL_COST
protected static final String SET_VIRTUAL_COST
- See Also:
- Constant Field Values
-
SET_PHYSICAL_COST
protected static final String SET_PHYSICAL_COST
- See Also:
- Constant Field Values
-
SET_INITIAL_LINK_SEGMENT_COST
protected static final String SET_INITIAL_LINK_SEGMENT_COST
- See Also:
- Constant Field Values
-
SET_INFRASTRUCTURE_NETWORK
protected static final String SET_INFRASTRUCTURE_NETWORK
- See Also:
- Constant Field Values
-
SET_ZONING
protected static final String SET_ZONING
- See Also:
- Constant Field Values
-
SET_DEMANDS
protected static final String SET_DEMANDS
- See Also:
- Constant Field Values
-
logSettings
protected boolean logSettings
flag indicating if settings are to be logged upon building the component or not
-
-
Method Detail
-
setInfrastructureNetwork
protected void setInfrastructureNetwork(LayeredNetwork<?,?> network)
Set the network- Parameters:
network
- to set
-
setZoning
protected void setZoning(Zoning zoning)
Set the zoning- Parameters:
zoning
- to set
-
setDemands
protected void setDemands(Demands demands)
Set the demands- Parameters:
demands
- to set
-
setOutputManager
protected void setOutputManager(OutputManager outputManager)
Set the output manager- Parameters:
outputManager
- to set
-
getOutputManager
protected OutputManager getOutputManager()
Collect the registered output manager- Returns:
- collected outputManager
-
getInfrastructureNetwork
public LayeredNetwork<?,?> getInfrastructureNetwork()
collect the registered network- Returns:
- network
-
getZoning
public Zoning getZoning()
Get the registered zoning- Returns:
- zoning
-
getDemands
public Demands getDemands()
Get the registered demands- Returns:
- demands
-
setLogSettings
public void setLogSettings(boolean flag)
Set the flag for logging all settings- Parameters:
flag
- to set
-
isLogSettings
public boolean isLogSettings()
Get the flag for logging all settings- Returns:
- true when logging false otherwise
-
createAndRegisterGapFunction
public GapFunctionConfigurator<? extends GapFunction> createAndRegisterGapFunction(String gapFunctionType) throws PlanItException
Create and Register gapFunction component- Parameters:
gapFunctionType
- the type of gap function component to be created- Returns:
- gap function configuration object
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterSmoothing
public SmoothingConfigurator<? extends Smoothing> createAndRegisterSmoothing(String smoothingType) throws PlanItException
Create and Register smoothing component- Parameters:
smoothingType
- the type of smoothing component to be created- Returns:
- Smoothing configuration object
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterPhysicalCost
public PhysicalCostConfigurator<? extends AbstractPhysicalCost> createAndRegisterPhysicalCost(String physicalTravelTimeCostFunctionType) throws PlanItException
Create and register physical link cost function to determine travel time- Parameters:
physicalTravelTimeCostFunctionType
- the type of cost function to be created- Returns:
- the physical cost created
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterVirtualCost
public VirtualCostConfigurator<? extends AbstractVirtualCost> createAndRegisterVirtualCost(String virtualTraveltimeCostFunctionType) throws PlanItException
Create and Register virtual link cost function to determine travel time- Parameters:
virtualTraveltimeCostFunctionType
- the type of cost function to be created- Returns:
- the cost function created
- Throws:
PlanItException
- thrown if there is an error
-
registerOutputFormatter
public void registerOutputFormatter(OutputFormatter outputFormatter) throws PlanItException
Register an output formatter- Parameters:
outputFormatter
- OutputFormatter being registered- Throws:
PlanItException
- thrown if there is an error or validation failure during setup of the output formatter
-
unregisterOutputFormatter
public void unregisterOutputFormatter(OutputFormatter outputFormatter) throws PlanItException
Remove an output formatter which has already been registered This is used by the Python interface, which registers the PlanItIO formatter by default- Parameters:
outputFormatter
- the output formatter to be removed- Throws:
PlanItException
- thrown if there is an error during removal of the output formatter
-
getOutputFormatters
public List<OutputFormatter> getOutputFormatters()
Returns a list of output formatters registered on this assignment- Returns:
- List of OutputFormatter objects registered on this assignment
-
registerInitialLinkSegmentCost
public void registerInitialLinkSegmentCost(InitialMacroscopicLinkSegmentCost initialLinkSegmentCost)
Register all available initial costs, both time period agnostic and time period specific, 1:1 on the assignment- Parameters:
initialLinkSegmentCost
- initial link segment cost for the current traffic assignment
-
registerInitialLinkSegmentCost
public void registerInitialLinkSegmentCost(InitialModesLinkSegmentCost initialLinkSegmentCost)
Register the initial link segment cost without relating it to a particular period, meaning that it is applied to all time periods that do not have a specified initial link segment costs registered for them- Parameters:
initialLinkSegmentCost
- initial link segment cost for the current traffic assignment
-
registerInitialLinkSegmentCost
public void registerInitialLinkSegmentCost(TimePeriod timePeriod, InitialModesLinkSegmentCost initialLinkSegmentCost) throws PlanItException
Register the initial link segment cost for a specified time period- Parameters:
timePeriod
- the specified time periodinitialLinkSegmentCost
- initial link segment cost for the current traffic assignment- Throws:
PlanItException
- thrown if time period is null
-
activateOutput
public OutputTypeConfiguration activateOutput(OutputType outputType) throws PlanItException
Method that allows one to activate specific output types for persistence on the traffic assignment instance- Parameters:
outputType
- OutputType object to be used- Returns:
- outputTypeConfiguration the output type configuration that is now active
- Throws:
PlanItException
- thrown if there is an error activating the output
-
deactivateOutput
public void deactivateOutput(OutputType outputType)
Deactivate an output type- Parameters:
outputType
- OutputType to be deactivated
-
isOutputTypeActive
public boolean isOutputTypeActive(OutputType outputType)
Verify if a given output type is active- Parameters:
outputType
- the output type to verify for- Returns:
- true if active, false otherwise
-
getOutputConfiguration
public OutputConfiguration getOutputConfiguration()
Provide the output configuration for user access- Returns:
- outputConfiguration for this traffic assignment
-
getGapFunction
public GapFunctionConfigurator<? extends GapFunction> getGapFunction()
Collect the gap function of the trafficAssignment instance- Returns:
- gapFunction
-
getPhysicalCost
public PhysicalCostConfigurator<? extends AbstractPhysicalCost> getPhysicalCost()
Collect the physical cost entity registered on the traffic assignment- Returns:
- physicalCost
-
getVirtualCost
public VirtualCostConfigurator<? extends AbstractVirtualCost> getVirtualCost()
Collect the virtual cost entity registered on the traffic assignment- Returns:
- virtual cost
-
getSmoothing
public SmoothingConfigurator<? extends Smoothing> getSmoothing()
Collect the smoothing entity registered on the traffic assignment- Returns:
- smoothing
-
-