Class 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
    • Field Detail

      • macroscopicLinkSegmentTypeByIdMap

        protected Map<Long,​MacroscopicLinkSegmentType> macroscopicLinkSegmentTypeByIdMap
        Map which stores link segment types by generated Id
      • bprParametersForLinkSegmentAndMode

        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)
    • 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 type
        capacity - capacity of the link segment type
        maximumDensity - maximum density of the link segment type
        linkSegmentExternalId - the external reference number of this link type
        modeProperties - 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 type
        convertToLong - 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