Class RoutedServicesLayerModifierImpl

    • Constructor Detail

      • RoutedServicesLayerModifierImpl

        public RoutedServicesLayerModifierImpl​(RoutedServicesLayerImpl routedServicesLayer)
        Constructor
        Parameters:
        routedServicesLayer - this modifier acts upon
    • Method Detail

      • fireEvent

        protected void fireEvent​(EventListener eventListener,
                                 Event event)
        Let derived class deal with the handling of the listener, where based on the derived event implementation the listener's concrete class can be determined which in turn allows for calling the right event callback method which is unknown at this base level since this event mechanism does not force a particular notification method signature on its listener interface
        Specified by:
        fireEvent in class EventProducerImpl
        Parameters:
        eventListener - to notify for the event
        event - to process for the listener
      • truncateToServiceNetwork

        public void truncateToServiceNetwork()
        Method that will truncate all routed entities to available service network entities in its parent in case the parent service network has been altered for some reason, i.e., the service network entities might still exist as references on the routed services but no longer exist in the related service layer. To be used - for example - in tandem with ServiceNetworkLayerModifier.removeUnmappedServiceNetworkEntities() which removes service network entities that are not attached to underlying physical network entities. this type of modification is useful for example when a parsed (routed) service network covers a larger area than the underlying physical network chosen, in which case some or many of the service routes are mapped to a service network that in turn could not be mapped to the physical network available. In those cases this method truncates all routes for which its service network elements are missing from its parent service layer (because they were fully or partially detached from a physical network and were removed because of it)

        Note that invoking this method will recreate all managed ids across the routed services due to gaps occurring after removal of unmapped entries

        Note that this implementation will automatically overwrite all pre-existing XML ids with the internal ids of all managed id containers within the routed services layer to ensure uniqueness on both levels of ids.

        Listeners can be registered for existing id modification events

        If, for some reason, the provided services by mode have no (more) entries the services by mode are removed from the layer. Same goes for routed services that have no more trips
        Specified by:
        truncateToServiceNetwork in interface RoutedServicesLayerModifier
      • consolidateIdenticallyScheduledTrips

        public void consolidateIdenticallyScheduledTrips​(Mode mode)
        Consolidate all PLANit RoutedTrips with identical relative timing schedules (but different departure times) into a single PLANit Routed trip. Redundant trips are removed. Not that Ids are not updated when these entries are removed from their respective containers. This is left to the user to do manually afterwards if desired.
        Specified by:
        consolidateIdenticallyScheduledTrips in interface RoutedServicesLayerModifier
        Parameters:
        mode - to do this for
      • removeEmptyRoutedServicesByMode

        public void removeEmptyRoutedServicesByMode​(boolean recreateRoutedServicesManagedEntitiesIds)
        Remove all RoutedServicesByMode instances from the layer in case they no longer have any services associated with them

        When recreateRoutedServicesManagedEntitiesIds is true, event for recreating routed services ids is fired for which a listener can be attached

        Specified by:
        removeEmptyRoutedServicesByMode in interface RoutedServicesLayerModifier
        Parameters:
        recreateRoutedServicesManagedEntitiesIds - when true recreate routed services ids, otherwise do not
      • removeRoutedServicesWithoutTrips

        public void removeRoutedServicesWithoutTrips​(boolean recreateRoutedServiceManagedIds,
                                                     Mode... modes)
        Remove all routed services from the layer in case they no longer have any trips associated with them for the given modes

        When managed id entities are recreated, it will do so for routed services

        Specified by:
        removeRoutedServicesWithoutTrips in interface RoutedServicesLayerModifier
        Parameters:
        recreateRoutedServiceManagedIds - when true recreate all managed ids on the layer, otherwise do not
        modes - to do this for
      • removeScheduledTripsWithoutLegs

        public void removeScheduledTripsWithoutLegs​(boolean recreateManagedEntitiesIds,
                                                    Mode... modes)
        Remove all scheduled trips from the layer (for the given modes) in case they have no relative leg timings. this might occur when only a single stop has been identified for a trip based on a parsed external data source for example, e.g., GTFS with a time period filter.

        When managed id entities are recreated, it will do so for trips and departure ids

        Specified by:
        removeScheduledTripsWithoutLegs in interface RoutedServicesLayerModifier
        Parameters:
        recreateManagedEntitiesIds - when true recreate all managed ids on the layer, otherwise do not
        modes - to do this for
      • removeDuplicateTripDepartures

        public void removeDuplicateTripDepartures​(boolean recreateManagedDepartureIds)
        Remove all duplicate scheduled trip departures from the layer. This might occur when there are duplicates in the exogenous data source for example

        When ids are recreated, it will do so for departure ids only

        Specified by:
        removeDuplicateTripDepartures in interface RoutedServicesLayerModifier
        Parameters:
        recreateManagedDepartureIds - when true recreate all departure ids on the layer, otherwise do not
      • recreateManagedEntitiesIds

        public void recreateManagedEntitiesIds()
        This method will recreate all ids of the routed services' components, but only when the containers used for them are the primary ManagedIdEntities containers, i.e., when the routed services layer is responsible for uniquely tracking all entities by their managed id. If not, it will not recreate the ids.

        The reasoning is that if we would recreate ids of the container while the container does not contain all = let's say - routes, their managedId is no longer guaranteed to be unique which can lead to issues

        Method can be used in conjunctions with the removal of parts of the routed services and the result is required to have unique contiguous ids All managed ids of the layer are recreated via recreateRoutedServicesIds(), recreateRoutedTripsIds(), and recreateRoutedTripScheduleDepartureIds() including their triggered events which will trigger callbacks to their event listeners (if any are registered)

        Specified by:
        recreateManagedEntitiesIds in interface RoutedServicesLayerModifier
      • recreateRoutedTripScheduleDepartureIds

        public void recreateRoutedTripScheduleDepartureIds()
        Recreate the ids of the routed services layer's routed trip departure ids across all scheduled trips across all modes Triggers a ModifiedTripScheduleDepartureIdsEvent upon completion
        Specified by:
        recreateRoutedTripScheduleDepartureIds in interface RoutedServicesLayerModifier
      • recreateRoutedTripsIds

        public void recreateRoutedTripsIds()
        Recreate the ids of the routed services layer's routed trips (scheduled and frequency based) across all modes Triggers a ModifiedRoutedTripIdsEvent upon completion
        Specified by:
        recreateRoutedTripsIds in interface RoutedServicesLayerModifier
      • recreateRoutedServicesIds

        public void recreateRoutedServicesIds()
        Recreate the ids of the routed services layer routedModeServices across all modes Triggers a ModifiedRoutedServicesIdsEvent upon completion
        Specified by:
        recreateRoutedServicesIds in interface RoutedServicesLayerModifier