Package jmri

Interface RouteManager

  • All Superinterfaces:
    Manager<Route>, PropertyChangeProvider, ProvidingManager<Route>, SilenceablePropertyChangeProvider, VetoableChangeProvider
    All Known Implementing Classes:
    DefaultRouteManager

    public interface RouteManager
    extends ProvidingManager<Route>
    Interface for obtaining Routes.

    This doesn't have a "new" method, since Routes are separately implemented, instead of being system-specific.


    This file is part of JMRI.

    JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.

    JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

    • Method Detail

      • dispose

        void dispose()
        Description copied from interface: Manager
        Free resources when no longer used. Specifically, remove all references to and from this object, so it can be garbage-collected.
        Specified by:
        dispose in interface Manager<Route>
      • provideRoute

        @Nonnull
        Route provideRoute​(@Nonnull
                           java.lang.String systemName,
                           @CheckForNull
                           java.lang.String userName)
                    throws java.lang.IllegalArgumentException
        Provides existing Route by UserName then SystemName if one exists. Create a new Route if the route does not exist.
        Parameters:
        systemName - the system name for the route
        userName - the user name for the route
        Returns:
        New or existing Route.
        Throws:
        java.lang.IllegalArgumentException - if there is trouble creating a new Route
      • newRoute

        @Nonnull
        Route newRoute​(@Nonnull
                       java.lang.String userName)
                throws java.lang.IllegalArgumentException
        Create a new Route if the route does not exist. Intended for use with User GUI, to allow the auto generation of systemNames, where the user can optionally supply a username.
        Parameters:
        userName - user name for the new route
        Returns:
        New Route.
        Throws:
        java.lang.IllegalArgumentException - if there is trouble creating a new Route
      • getRoute

        @CheckForNull
        Route getRoute​(@Nonnull
                       java.lang.String name)
        Locate via user name, then system name if needed. Does not create a new one if nothing found.
        Parameters:
        name - User name or system name to match
        Returns:
        null if no match found
      • deleteRoute

        void deleteRoute​(@Nonnull
                         Route r)
        Delete Route by removing it from the manager. The Route must first be deactivated so it stops processing.
        Parameters:
        r - the route to remove