Class PhysicalNetwork.LinkSegments

    • Constructor Detail

      • LinkSegments

        public LinkSegments()
        Constructor
    • Method Detail

      • registerLinkSegment

        protected void registerLinkSegment​(LinkSegment linkSegment)
                                    throws PlanItException
        Register a link segment on the network
        Parameters:
        linkSegment - the link segment to be registered
        Throws:
        PlanItException - thrown if the current link segment external Id has already been assigned
      • getLinkSegmentByStartAndEndNodeId

        public LinkSegment getLinkSegmentByStartAndEndNodeId​(long startId,
                                                             long endId)
        Find a LinkSegment by the external Ids of its start and end nodes
        Parameters:
        startId - reference to start node
        endId - reference to end node
        Returns:
        the linkSegment found
      • createDirectionalLinkSegment

        public LinkSegment createDirectionalLinkSegment​(Link parentLink,
                                                        boolean directionAB)
                                                 throws PlanItException
        Create directional link segment
        Parameters:
        parentLink - the parent link of this link segment
        directionAB - direction of travel
        Returns:
        the created link segment
        Throws:
        PlanItException - thrown if there is an error
      • registerLinkSegment

        public void registerLinkSegment​(Link parentLink,
                                        LinkSegment linkSegment,
                                        boolean directionAB)
                                 throws PlanItException
        Register a link segment
        Parameters:
        parentLink - the parent link which specified link segment will be registered on
        linkSegment - link segment to be registered
        directionAB - direction of travel
        Throws:
        PlanItException - thrown if there is an error
      • getLinkSegment

        public LinkSegment getLinkSegment​(long id)
        Get link segment by id
        Parameters:
        id - id of the link segment
        Returns:
        retrieved linkSegment
      • getNumberOfLinkSegments

        public int getNumberOfLinkSegments()
        Return number of registered link segments
        Returns:
        number of registered link segments
      • getLinkSegmentByExternalId

        public LinkSegment getLinkSegmentByExternalId​(Object externalId,
                                                      boolean convertToLong)
        Retrieve a link segment 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
        convertToLong - if true, the external Id is converted into a long before beginning the search
        Returns:
        the retrieved link segment, or null if no mode was found
      • getLinkSegmentByExternalId

        public LinkSegment getLinkSegmentByExternalId​(Object externalId)
        Retrieve a link segment 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. 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, or null if no link segment type was found