Class MacroscopicNetwork
- java.lang.Object
-
- org.djutils.event.EventProducer
-
- org.planit.trafficassignment.TrafficAssignmentComponent<PhysicalNetwork>
-
- org.planit.network.physical.PhysicalNetwork
-
- org.planit.network.physical.macroscopic.MacroscopicNetwork
-
- All Implemented Interfaces:
Serializable
,org.djutils.event.EventProducerInterface
public class MacroscopicNetwork extends PhysicalNetwork
Macroscopic Network which stores link segment types- Author:
- markr
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.planit.network.physical.PhysicalNetwork
PhysicalNetwork.Links, PhysicalNetwork.LinkSegments, PhysicalNetwork.Modes, PhysicalNetwork.Nodes
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<MacroscopicLinkSegment,Map<Mode,Pair<Double,Double>>>
bprParametersForLinkSegmentAndMode
Map containing the BPR parameters for link segment and mode, if these are specified in the network file (null if default values are being used)protected Map<Long,MacroscopicLinkSegmentType>
macroscopicLinkSegmentTypeByIdMap
Map which stores link segment types by generated Id-
Fields inherited from class org.planit.network.physical.PhysicalNetwork
links, linkSegments, MACROSCOPICNETWORK, modes, networkBuilder, nodes
-
Fields inherited from class org.planit.trafficassignment.TrafficAssignmentComponent
groupId, id, trafficComponentType
-
-
Constructor Summary
Constructors Constructor Description MacroscopicNetwork(IdGroupingToken groupId)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MacroscopicLinkSegmentType
createAndRegisterNewMacroscopicLinkSegmentType(String name, double capacity, double maximumDensity, Object linkSegmentExternalId, Map<Mode,MacroscopicModeProperties> modeProperties)
Create and register new macroscopic link segment type on network.MacroscopicLinkSegmentType
findMacroscopicLinkSegmentTypeById(long id)
Return a link segment type identified by its generated idMacroscopicLinkSegmentType
getMacroscopicLinkSegmentTypeByExternalId(Object externalId)
Retrieve a link segment type by its external Id This method is not efficient, since it loops through all the registered modes in order to find the required link segment type.MacroscopicLinkSegmentType
getMacroscopicLinkSegmentTypeByExternalId(Object externalId, boolean convertToLong)
Retrieve a link segment type by its external Id This method has the option to convert the external Id parameter into a long value, to find the link segment type when link segment type objects use long values for external ids.MacroscopicLinkSegmentType
registerLinkSegmentType(MacroscopicLinkSegmentType linkSegmentType)
Register a link segment type on the network-
Methods inherited from class org.planit.network.physical.PhysicalNetwork
getNetworkIdGroupingToken
-
Methods inherited from class org.planit.trafficassignment.TrafficAssignmentComponent
getId, getIdGroupingtoken, getSourceId, getTrafficComponentType
-
Methods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, getEventTypesWithListeners, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
-
-
-
Field Detail
-
macroscopicLinkSegmentTypeByIdMap
protected Map<Long,MacroscopicLinkSegmentType> macroscopicLinkSegmentTypeByIdMap
Map which stores link segment types by generated Id
-
-
Constructor Detail
-
MacroscopicNetwork
public MacroscopicNetwork(IdGroupingToken groupId)
Constructor- Parameters:
groupId
- contiguous id generation within this group for instances of this class
-
-
Method Detail
-
createAndRegisterNewMacroscopicLinkSegmentType
public MacroscopicLinkSegmentType createAndRegisterNewMacroscopicLinkSegmentType(String name, double capacity, double maximumDensity, Object linkSegmentExternalId, Map<Mode,MacroscopicModeProperties> modeProperties) throws PlanItException
Create and register new macroscopic link segment type on network.- Parameters:
name
- name of the link segment typecapacity
- capacity of the link segment typemaximumDensity
- maximum density of the link segment typelinkSegmentExternalId
- the external reference number of this link typemodeProperties
- mode properties of the link segment type- Returns:
- the link segment type
- Throws:
PlanItException
- thrown if there is an error
-
registerLinkSegmentType
public MacroscopicLinkSegmentType registerLinkSegmentType(MacroscopicLinkSegmentType linkSegmentType)
Register a link segment type on the network- Parameters:
linkSegmentType
- the MacroscopicLinkSegmentType to be registered- Returns:
- the registered link segment type
-
findMacroscopicLinkSegmentTypeById
public MacroscopicLinkSegmentType findMacroscopicLinkSegmentTypeById(long id)
Return a link segment type identified by its generated id- Parameters:
id
- id value of the MacroscopicLinkSegmentType- Returns:
- MacroscopicLinkSegmentType object found
-
getMacroscopicLinkSegmentTypeByExternalId
public MacroscopicLinkSegmentType getMacroscopicLinkSegmentTypeByExternalId(Object externalId, boolean convertToLong)
Retrieve a link segment type by its external Id This method has the option to convert the external Id parameter into a long value, to find the link segment type when link segment type objects use long values for external ids.- Parameters:
externalId
- the external Id of the specified link segment typeconvertToLong
- if true, the external Id is converted into a long before beginning the search- Returns:
- the retrieved link segment type, or null if no mode was found
-
getMacroscopicLinkSegmentTypeByExternalId
public MacroscopicLinkSegmentType getMacroscopicLinkSegmentTypeByExternalId(Object externalId)
Retrieve a link segment type by its external Id This method is not efficient, since it loops through all the registered modes in order to find the required link segment type. The equivalent method in InputBuilderListener is more efficient and should be used in preference to this in Java code.- Parameters:
externalId
- the external Id of the specified link segment type- Returns:
- the retrieved link segment type, or null if no link segment type was found
-
-