Class BusItineraryHalt

    • Field Detail

      • DISTANCE_BETWEEN_HALT_AND_ROAD_BORDER

        public static final double DISTANCE_BETWEEN_HALT_AND_ROAD_BORDER
        Distance between the road border and the bus halt.
        See Also:
        Constant Field Values
    • Constructor Detail

      • BusItineraryHalt

        BusItineraryHalt​(BusItinerary itinerary,
                         String name,
                         BusItineraryHalt.BusItineraryHaltType type)
        Create a halt with attributes stored in memory.
        Parameters:
        itinerary - is the itinerary on which thus bus halt was located.
        type - is the type of the bus halt.
        name - is the name of the new bus halt
      • BusItineraryHalt

        BusItineraryHalt​(UUID id,
                         BusItinerary itinerary,
                         String name,
                         BusItineraryHalt.BusItineraryHaltType type)
        Create a halt with attributes stored in memory.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        itinerary - is the itinerary on which thus bus halt was located.
        type - is the type of the bus halt.
        name - is the name of the new bus halt
        Since:
        2.0
      • BusItineraryHalt

        BusItineraryHalt​(BusItinerary itinerary,
                         String name,
                         BusItineraryHalt.BusItineraryHaltType type,
                         AttributeCollection attributeProvider)
        Create a bus halt.
        Parameters:
        itinerary - is the itinerary on which thus bus halt was located.
        name - is the name of the new bus halt
        type - is the type of the bus halt.
        attributeProvider - is the provider of attributes used by this bus halt.
      • BusItineraryHalt

        BusItineraryHalt​(UUID id,
                         BusItinerary itinerary,
                         String name,
                         BusItineraryHalt.BusItineraryHaltType type,
                         AttributeCollection attributeProvider)
        Create a bus halt.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        itinerary - is the itinerary on which thus bus halt was located.
        name - is the name of the new bus halt
        type - is the type of the bus halt.
        attributeProvider - is the provider of attributes used by this bus halt.
        Since:
        2.0
    • Method Detail

      • getFirstFreeBushaltName

        @Pure
        public static String getFirstFreeBushaltName​(BusItinerary busItinerary)
        Replies a bus halt name that was not exist in the specified bus itinerary.
        Parameters:
        busItinerary - is the bus itinerary for which a free bus halt name may be computed.
        Returns:
        a name suitable for bus halt.
      • getInvalidListIndex

        @Pure
        public int getInvalidListIndex()
        Replies the unique id in the sorted list of invalid halts.
        Returns:
        the id.
      • setInvalidListIndex

        void setInvalidListIndex​(int id)
        Set the unique id in the sorted list of invalid halts.
        Parameters:
        id - the index.
      • 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<BusItinerary>
        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.
      • getBusStop

        @Pure
        public BusStop getBusStop()
        Replies the bus stop associated to this halt.
        Returns:
        the bus halt associated to this halt, or null if this halt is not associated to a bus halt.
      • setBusStop

        public boolean setBusStop​(BusStop busStop)
        Set the bus stop associated to this halt.
        Parameters:
        busStop - is the bus stop associated to this halt, or null if this halt is not associated to a bus stop.
        Returns:
        true if the bus stop was correctly set, otherwise false.
      • clearPositionBuffers

        protected void clearPositionBuffers()
        Clear internal buffers related to the bus halt position.
      • getPosition2D

        @Pure
        public Point2d getPosition2D()
        Replies the position of the bus halt on the road. The replied position may differ from the position of the associated bus stop because the position on the road is a projection of the stop's position on the road.
        Returns:
        the 2D position or null if the halt is not associated to a road segment.
      • getPosition1D

        @Pure
        public Point1d getPosition1D()
        Replies the position of the bus halt on the road. The replied position may differ from the position of the associated bus stop because the position on the road is a projection of the stop's position on the road.
        Returns:
        the 1.5D position or null if the halt is not associated to a road segment.
      • getRoadSegment

        @Pure
        public RoadSegment getRoadSegment()
        Replies the road segment on which this bus halt was.
        Returns:
        the road segment
      • getRoadSegmentIndex

        @Pure
        public int getRoadSegmentIndex()
        Replies the index of the road segment on which this bus halt was.
        Returns:
        the index of the road segment in the itinerary.
      • setRoadSegmentIndex

        void setRoadSegmentIndex​(int idx)
        Set the index of the road segment on which this bus halt was.
        Parameters:
        idx - is the index of the road segment
      • getPositionOnSegment

        @Pure
        public double getPositionOnSegment()
        Replies the position on the segment.
        Returns:
        the curviline distance on the segment from its first point.
      • setPositionOnSegment

        void setPositionOnSegment​(double position)
        Set the position on the segment. The position is the curviline distance on the segment.

        This function does not check the validity of the halt.

        Parameters:
        position - is the position on the segment.
      • isTerminus

        @Pure
        public boolean isTerminus()
        Replies if this bus halt is a terminus (aka. first or last bus halt) of an itinerary.
        Returns:
        true if the bus halt is a terminus, otherwise false
      • isStartingBusHalt

        @Pure
        public boolean isStartingBusHalt()
        Replies if this bus halt is a starting bus halt (aka. first bus halt) of an itinerary.
        Returns:
        true if the bus halt is a starting bus halt, otherwise false
      • isEndingBusHalt

        @Pure
        public boolean isEndingBusHalt()
        Replies if this bus halt is a ending bus halt (aka. last bus halt) of an itinerary.
        Returns:
        true if the bus halt is a ending bus halt, otherwise false
      • insideBusHub

        @Pure
        public boolean insideBusHub()
        Replies if this bus halt is inside a hub throught an associated bus stop.
        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 halt is located in throught an associated bus stop.
        Returns:
        the hubs
      • busHubIterator

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

        @Pure
        public final 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<BusItinerary>
        Returns:
        a location
        See Also:
        GISPrimitive.getGeoId(), GISPrimitive.getGeoLocation()
      • getGeoPosition

        @Pure
        public GeoLocationPoint getGeoPosition()
        Replies the geo position.
        Returns:
        the geo position.
      • distanceToBusStop

        @Pure
        public double distanceToBusStop()
        Replies the distance between the position of this bus itinerary halt and the position of the bus stop associated to this bus itinerary halt.
        Returns:
        the distance between the position of this bus itinerary halt and the position of the bus stop associated to this bus itinerary halt.
        Since:
        2.0
      • distance

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

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

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

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

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