Class BusStop

    • Constructor Detail

      • BusStop

        public BusStop​(String name)
        Create a stop with attributes stored in memory.
        Parameters:
        name - is the name of the new bus stop
      • BusStop

        public BusStop​(UUID id,
                       String name)
        Create a stop with attributes stored in memory.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        name - is the name of the new bus stop
      • BusStop

        public BusStop​(String name,
                       AttributeCollection attributeProvider)
        Create a bus stop.
        Parameters:
        name - is the name of the new bus stop
        attributeProvider - is the provider of attributes used by this bus stop.
      • BusStop

        public BusStop​(UUID id,
                       String name,
                       AttributeCollection attributeProvider)
        Create a bus stop.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        name - is the name of the new bus stop
        attributeProvider - is the provider of attributes used by this bus stop.
      • BusStop

        public BusStop​(String name,
                       GeoLocationPoint position)
        Create a stop with attributes stored in memory.
        Parameters:
        name - is the name of the new bus stop
        position - is the position of the bus stop.
      • BusStop

        public BusStop​(UUID id,
                       String name,
                       GeoLocationPoint position)
        Create a stop with attributes stored in memory.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        name - is the name of the new bus stop
        position - is the position of the bus stop.
      • BusStop

        public BusStop​(String name,
                       GeoLocationPoint position,
                       AttributeCollection attributeProvider)
        Create a bus stop.
        Parameters:
        name - is the name of the new bus stop
        position - is the position of the bus stop.
        attributeProvider - is the provider of attributes used by this bus stop.
      • BusStop

        public BusStop​(UUID id,
                       String name,
                       GeoLocationPoint position,
                       AttributeCollection attributeProvider)
        Create a bus stop.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        name - is the name of the new bus stop.
        position - is the position of the bus stop.
        attributeProvider - is the provider of attributes used by this bus stop.
    • Method Detail

      • getFirstFreeBusStopName

        @Pure
        public static String getFirstFreeBusStopName​(BusNetwork busNetwork)
        Replies a bus stop name that was not exist in the specified bus network.
        Parameters:
        busNetwork - is the bus network for which a free bus stop name may be computed.
        Returns:
        a name suitable for bus stop.
      • fireValidityChangedFor

        protected void fireValidityChangedFor​(Object changedObject,
                                              int index,
                                              BusPrimitiveInvalidity oldReason,
                                              BusPrimitiveInvalidity newReason)
        Description copied from class: AbstractBusPrimitive
        Fire the event that indicates the validity of the object has changed.
        Overrides:
        fireValidityChangedFor in class AbstractBusPrimitive<BusNetwork>
        Parameters:
        changedObject - is the object for which the validity has changed.
        index - is the index of the changedObject in its parent.
        oldReason - is the old invalidity reason before the change.
        newReason - is the current invalidity reason after the change.
      • 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.
      • setPosition

        public void setPosition​(GeoLocationPoint position)
        Set the position of the element.
        Parameters:
        position - the position.
      • getGeoPosition

        @Pure
        public GeoLocationPoint getGeoPosition()
        Replies the position of the bus stop.
        Returns:
        the position or null if never set before.
      • getPosition2D

        @Pure
        public Point2d getPosition2D()
        Replies the position of the bus stop.
        Returns:
        the position
      • getGeoLocation

        @Pure
        public GeoLocation getGeoLocation()
        Description copied from interface: GISPrimitive
        Replies the geo-location.

        A GeoLocation is unique according to the geo-location of the element. If two elements have the same points in the same order, or if two elements have the same points in a reverse order, they must have equal GeoLocations.

        The following code is always true (where the arguments of the constructors are the list of points of the polyline). It illustrates that for two elements with the same geo-localized points, they have the same geo-location identifier (Geo-Id) and they have different unique ientifier (Uid):

        
         GISElement obj1 = new MapPolyline(100,10,200,30,300,4);
         GISElement obj2 = new MapPolyline(100,10,200,30,300,4);
         assert( obj1.getGeoId().equals(obj2.getGeoId()) );
         assert( obj2.getGeoId().equals(obj1.getGeoId()) );
         assert( ! obj1.getUid().equals(obj2.getUid()) );
         assert( ! obj2.getUid().equals(obj1.getUid()) );
         
        Specified by:
        getGeoLocation in interface GISPrimitive
        Overrides:
        getGeoLocation in class AbstractBusPrimitive<BusNetwork>
        Returns:
        a location
        See Also:
        GISPrimitive.getGeoId(), GISPrimitive.getGeoLocation()
      • distance

        @Pure
        public double distance​(double x,
                               double y)
        Replies the distance between the given point and this bus stop.
        Parameters:
        x - x coordinate.
        y - y coordinate.
        Returns:
        the distance to this bus stop
      • distance

        @Pure
        public double distance​(BusStop stop)
        Replies the distance between the given bus stop and this bus stop.
        Parameters:
        stop - the stop.
        Returns:
        the distance to this bus stop
      • distance

        @Pure
        public double distance​(BusItineraryHalt halt)
        Replies the distance between the given bus itinerary halt and this bus stop.
        Parameters:
        halt - the halt.
        Returns:
        the distance to this bus stop
      • distance

        @Pure
        public double distance​(Point2D<?,​?> point)
        Replies the distance between the given point and this bus stop.
        Parameters:
        point - the pint
        Returns:
        the distance to this bus stop
      • distance

        @Pure
        public double distance​(GeoLocationPoint point)
        Replies the distance between the given point and this bus stop.
        Parameters:
        point - the point.
        Returns:
        the distance to this bus stop
      • addBusHub

        void addBusHub​(BusHub hub)
        Add a hub reference.
        Parameters:
        hub - the hub.
      • removeBusHub

        void removeBusHub​(BusHub hub)
        Remove a hub reference.
        Parameters:
        hub - the hub.
      • insideBusHub

        @Pure
        public boolean insideBusHub()
        Replies if this bus stop is inside a hub.
        Returns:
        true if this bus stop is inside a hub, otherwise false
      • busHubs

        @Pure
        public Iterable<BusHub> busHubs()
        Replies the hubs in which this bus stop is located.
        Returns:
        the hubs
      • busHubIterator

        @Pure
        public Iterator<BusHub> busHubIterator()
        Replies the hubs in which this bus stop is located.
        Returns:
        the hubs
      • addBusHalt

        void addBusHalt​(BusItineraryHalt halt)
        Add a bus halt reference.
        Parameters:
        halt - the halt.
      • removeBusHalt

        void removeBusHalt​(BusItineraryHalt halt)
        Remove a bus halt reference.
        Parameters:
        halt - the halt.
      • isBusHaltBinded

        @Pure
        public boolean isBusHaltBinded()
        Replies if this bus stop is associated to a bus itinerary halt.
        Returns:
        true if this bus stop is associated to a bus itinerary halt, otherwise false
      • getBindedBusHalts

        @Pure
        public Iterable<BusItineraryHalt> getBindedBusHalts()
        Replies the bus itinerary halts associated to this bus stop.
        Returns:
        the bus itinerary halts.