Class BusNetwork

    • Constructor Detail

      • BusNetwork

        public BusNetwork​(String name,
                          RoadNetwork roadNetwork,
                          AttributeCollection attributeProvider)
        Create bus network.
        Parameters:
        name - is the name of the new bus network
        roadNetwork - is the road network on which the bus network is mapped.
        attributeProvider - is the attribute provider which must be used by this object.
      • BusNetwork

        public BusNetwork​(UUID id,
                          String name,
                          RoadNetwork roadNetwork,
                          AttributeCollection attributeProvider)
        Create bus network.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        name - is the name of the new bus network
        roadNetwork - is the road network on which the bus network is mapped.
        attributeProvider - is the attribute provider which must be used by this object.
        Since:
        2.0
      • BusNetwork

        public BusNetwork​(RoadNetwork roadNetwork,
                          AttributeCollection attributeProvider)
        Create bus network.
        Parameters:
        roadNetwork - is the road network on which the bus network is mapped.
        attributeProvider - is the attribute provider which must be used by this object.
      • BusNetwork

        public BusNetwork​(UUID id,
                          RoadNetwork roadNetwork,
                          AttributeCollection attributeProvider)
        Create bus network.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        roadNetwork - is the road network on which the bus network is mapped.
        attributeProvider - is the attribute provider which must be used by this object.
        Since:
        2.0
      • BusNetwork

        public BusNetwork​(String name,
                          RoadNetwork roadNetwork)
        Create bus network with a storage in memory of the attributes.
        Parameters:
        name - is the name of the new bus network
        roadNetwork - is the road network on which the bus network is mapped.
      • BusNetwork

        public BusNetwork​(UUID id,
                          String name,
                          RoadNetwork roadNetwork)
        Create bus network with a storage in memory of the attributes.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        name - is the name of the new bus network
        roadNetwork - is the road network on which the bus network is mapped.
        Since:
        2.0
      • BusNetwork

        public BusNetwork​(RoadNetwork roadNetwork)
        Create bus network with a storage in memory of the attributes.
        Parameters:
        roadNetwork - is the road network on which the bus network is mapped.
      • BusNetwork

        public BusNetwork​(UUID id,
                          RoadNetwork roadNetwork)
        Create bus network with a storage in memory of the attributes.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        roadNetwork - is the road network on which the bus network is mapped.
        Since:
        2.0
    • Method Detail

      • getElementType

        public Class<? extends BusLine> getElementType()
        Description copied from interface: InformedIterable
        Replies the class of the elements in this iterable object.
        Returns:
        the type of the elements.
      • getBusNetwork

        @Pure
        public BusNetwork getBusNetwork()
        Description copied from interface: BusPrimitive
        Replies the bus network in which this primitive is.
        Returns:
        the bus network in which this primitive is.
      • getRoadNetwork

        @Pure
        public RoadNetwork getRoadNetwork()
        Replies the road network in which this bus network is mapped.
        Returns:
        the road network in which this bus network is mapped.
      • size

        @Pure
        public int size()
        Description copied from interface: GISContainer
        Replies the count of map elements inside this container.
        Returns:
        the count of map elements inside this container.
      • isValidBusStops

        @Pure
        public boolean isValidBusStops()
        Replies if all the bus stops are valid.
        Returns:
        true if all the bus stops are valid, otherwise false.
      • isValidBusHubs

        @Pure
        public boolean isValidBusHubs()
        Replies if all the bus hubs are valid.
        Returns:
        true if all the bus hubs are valid, otherwise false.
      • addBusLine

        public boolean addBusLine​(BusLine busLine)
        Add a bus line inside the bus network.
        Parameters:
        busLine - is the bus line to insert.
        Returns:
        true if the bus line was added, otherwise false
      • addBusLine

        public boolean addBusLine​(BusLine busLine,
                                  int index)
        Add a bus line at the specified index.
        Parameters:
        busLine - is the bus line to insert.
        index - the index.
        Returns:
        true if the bus line was added, otherwise false
      • removeAllBusLines

        public void removeAllBusLines()
        Remove all the bus lines from the current network.
      • removeBusLine

        public boolean removeBusLine​(BusLine busLine)
        Remove a bus line from this network. All the itineraries and the associated stops will be removed also. If this bus line removal implies empty hubs, these hubs will be also removed.
        Parameters:
        busLine - is the bus line to remove.
        Returns:
        true if the bus line was successfully removed, otherwise false
      • removeBusLine

        public boolean removeBusLine​(String name)
        Remove the bus line with the given name. All the itineraries and the associated stops will be removed also. If this bus line removal implies empty hubs, these hubs will be also removed.
        Parameters:
        name - is the name of the bus line to remove.
        Returns:
        true if the bus line was successfully removed, otherwise false
      • removeBusLine

        public boolean removeBusLine​(int index)
        Remove the bus line at the specified index. All the itineraries and the associated stops will be removed also. If this bus line removal implies empty hubs, these hubs will be also removed.
        Parameters:
        index - is the index of the bus line to remove.
        Returns:
        true if the bus line was successfully removed, otherwise false
      • getBusLineCount

        @Pure
        public int getBusLineCount()
        Replies the count of bus lines into this network.
        Returns:
        the count of bus lines into this network.
      • indexOf

        @Pure
        public int indexOf​(BusLine busLine)
        Replies the index of the specified bus line.
        Parameters:
        busLine - is the bus line to search for.
        Returns:
        the index or -1 if it was not found.
      • getBusLineAt

        @Pure
        public BusLine getBusLineAt​(int index)
        Replies the line at the specified index.
        Parameters:
        index - the index.
        Returns:
        BusLine
        Throws:
        IndexOutOfBoundsException - in case of error.
      • getBusLine

        @Pure
        public BusLine getBusLine​(String name)
        Replies the bus line with the specified name.
        Parameters:
        name - is the desired name
        Returns:
        BusLine or null
      • getBusLine

        @Pure
        public BusLine getBusLine​(UUID uuid)
        Replies the bus line with the specified uuid.
        Parameters:
        uuid - the identifier.
        Returns:
        BusLine or null
      • getBusLine

        @Pure
        public BusLine getBusLine​(String name,
                                  Comparator<String> nameComparator)
        Replies the bus line with the specified name.
        Parameters:
        name - is the desired name
        nameComparator - is used to compare the names.
        Returns:
        BusLine or null
      • busLineIterator

        @Pure
        public Iterator<BusLine> busLineIterator()
        Replies the list of the bus lines of the bus network.
        Returns:
        a list of bus lines
      • busLines

        @Pure
        public Iterable<BusLine> busLines()
        Replies the list of the bus lines of the bus network.
        Returns:
        a list of bus lines
      • addBusStop

        public boolean addBusStop​(BusStop busStop)
        Add a bus stop inside the bus network.
        Parameters:
        busStop - is the bus stop to insert.
        Returns:
        true if the bus stop was added, otherwise false
      • removeAllBusStops

        public void removeAllBusStops()
        Remove all the bus stops from the current network.
      • removeBusStop

        public boolean removeBusStop​(BusStop busStop)
        Remove a bus stop from this network. If this bus stop removal implies empty hubs, these hubs will be also removed.
        Parameters:
        busStop - is the bus stop to remove.
        Returns:
        true if the bus stop was successfully removed, otherwise false
      • removeBusStop

        public boolean removeBusStop​(String name)
        Remove the bus stops with the given name. If this bus stop removal implies empty hubs, these hubs will be also removed.
        Parameters:
        name - is the name of the bus stop to remove.
        Returns:
        true if the bus stop was successfully removed, otherwise false
      • getBusStopCount

        @Pure
        public int getBusStopCount()
        Replies the count of bus stops into this network.
        Returns:
        the count of bus stops into this network.
      • getBusStop

        @Pure
        public BusStop getBusStop​(String name)
        Replies the bus stop with the specified name.
        Parameters:
        name - is the desired name
        Returns:
        BusStop or null
      • getBusStop

        @Pure
        public BusStop getBusStop​(UUID id)
        Replies the bus stop with the specified id.
        Parameters:
        id - is the desired identifier
        Returns:
        BusStop or null
      • getBusStop

        @Pure
        public BusStop getBusStop​(String name,
                                  Comparator<String> nameComparator)
        Replies the bus stop with the specified name.
        Parameters:
        name - is the desired name
        nameComparator - is used to compare the names.
        Returns:
        BusStop or null
      • busStopIterator

        @Pure
        public Iterator<BusStop> busStopIterator()
        Replies the list of the bus stops of the bus network.
        Returns:
        a list of bus stops
      • busStops

        @Pure
        public Iterable<BusStop> busStops()
        Replies the list of the bus stops of the bus network.
        Returns:
        a list of bus stops
      • getBusStopsIn

        @Pure
        public Iterator<BusStop> getBusStopsIn​(Rectangle2afp<?,​?,​?,​?,​?,​?> clipBounds)
        Replies the set of bus stops that have an intersection with the specified rectangle.

        This function replies the bus stops with a broad-first iteration on the elements' tree.

        Parameters:
        clipBounds - is the bounds outside which the bus stops will not be replied
        Returns:
        the bus stops inside the specified bounds.
      • getNearestBusStop

        @Pure
        public final BusStop getNearestBusStop​(Point2D<?,​?> point)
        Replies the nearest bus stop to the given point.
        Parameters:
        point - the point.
        Returns:
        the nearest bus stop or null if none was found.
      • getNearestBusStop

        @Pure
        public final BusStop getNearestBusStop​(GeoLocationPoint point)
        Replies the nearest bus stop to the given point.
        Parameters:
        point - the point
        Returns:
        the nearest bus stop or null if none was found.
      • getNearestBusStop

        @Pure
        public BusStop getNearestBusStop​(double x,
                                         double y)
        Replies the nearest bus stops to the given point.
        Parameters:
        x - x coordinate.
        y - y coordinate.
        Returns:
        the nearest bus stop or null if none was found.
      • addBusHub

        public BusHub addBusHub​(BusStop... stops)
        Add a bus hub in this network. At least, one bus stop must be given to create a hub. The name of the hub is deduced from the bus stops names.
        Parameters:
        stops - are the bus stops to put inside the hub.
        Returns:
        the create bus hub, or null if not created.
      • addBusHub

        public BusHub addBusHub​(String name,
                                BusStop... stops)
        Add a bus hub in this network. At least, one bus stop must be given to create a hub if you pass a null name.
        Parameters:
        name - is the name of the hub.
        stops - are the bus stops to put inside the hub.
        Returns:
        the create bus hub, or null if not created.
      • removeAllBusHubs

        public void removeAllBusHubs()
        Remove all the bus hubs from the current network.
      • removeBusHub

        public boolean removeBusHub​(BusHub busHub)
        Remove a bus hubs from this network.
        Parameters:
        busHub - is the bus hub to remove.
        Returns:
        true if the bus hub was successfully removed, otherwise false
      • removeBusHub

        public boolean removeBusHub​(String name)
        Remove the bus hub with the given name.
        Parameters:
        name - is the name of the bus hub to remove.
        Returns:
        true if the bus hub was successfully removed, otherwise false
      • getBusHubCount

        @Pure
        public int getBusHubCount()
        Replies the count of bus hubs into this network.
        Returns:
        the count of bus hubs into this network.
      • getBusHub

        @Pure
        public BusHub getBusHub​(String name)
        Replies the bus hub with the specified name.
        Parameters:
        name - is the desired name
        Returns:
        a bus hub or null
      • getBusHub

        @Pure
        public BusHub getBusHub​(UUID uuid)
        Replies the bus hub with the specified uuid.
        Parameters:
        uuid - the identifier.
        Returns:
        a bus hub or null
      • getBusHub

        @Pure
        public BusHub getBusHub​(String name,
                                Comparator<String> nameComparator)
        Replies the bus hub with the specified name.
        Parameters:
        name - is the desired name
        nameComparator - is used to compare the names.
        Returns:
        a bus hub or null
      • busHubIterator

        @Pure
        public Iterator<BusHub> busHubIterator()
        Replies the list of the bus hubs of the bus network.
        Returns:
        a list of bus hubs.
      • busHubs

        @Pure
        public Iterable<BusHub> busHubs()
        Replies the list of the bus hubs of the bus network.
        Returns:
        a list of bus hubs
      • getBusHubsIn

        @Pure
        public Iterator<BusHub> getBusHubsIn​(Rectangle2afp<?,​?,​?,​?,​?,​?> clipBounds)
        Replies the set of bus hubs that have an intersection with the specified rectangle.

        This function replies the bus hubs with a broad-first iteration on the hubs' tree.

        Parameters:
        clipBounds - is the bounds outside which the bus hubs will not be replied
        Returns:
        the bus hubs inside the specified bounds.
      • getNearestBusHub

        @Pure
        public final BusHub getNearestBusHub​(Point2D<?,​?> point)
        Replies the nearest bus hub to the given point.
        Parameters:
        point - the point
        Returns:
        the nearest bus hub or null if none was found.
      • getNearestBusHub

        @Pure
        public final BusHub getNearestBusHub​(GeoLocationPoint point)
        Replies the nearest bus hub to the given point.
        Parameters:
        point - the point
        Returns:
        the nearest bus hub or null if none was found.
      • getNearestBusHub

        @Pure
        public BusHub getNearestBusHub​(double x,
                                       double y)
        Replies the nearest bus hub to the given point.
        Parameters:
        x - x coordinate.
        y - y coordinate.
        Returns:
        the nearest bus hub or null if none was found.