Package jmri

Class TransitManager

All Implemented Interfaces:
PropertyChangeListener, VetoableChangeListener, EventListener, PropertyChangeFirer, PropertyChangeProvider, SilenceablePropertyChangeProvider, VetoableChangeFirer, VetoableChangeProvider, InstanceManagerAutoDefault, Manager<Transit>

public class TransitManager
extends AbstractManager<Transit>
implements InstanceManagerAutoDefault
Implementation of a Transit Manager

This doesn't need an interface, since Transits are globaly implemented, instead of being system-specific.

Note that Transit system names must begin with system prefix and type character, usually IZ, and be followed by a string, usually, but not always, a number. This is enforced when a Transit is created.

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.

  • Constructor Details

  • Method Details

    • getXMLOrder

      public int getXMLOrder()
      Description copied from interface: Manager
      Determine the order that types should be written when storing panel files. Uses one of the constants defined in this class.

      Yes, that's an overly-centralized methodology, but it works for now.

      Specified by:
      getXMLOrder in interface Manager<Transit>
      write order for this Manager; larger is later.
    • typeLetter

      public char typeLetter()
      Specified by:
      typeLetter in interface Manager<Transit>
      The type letter for a specific implementation
    • createNewTransit

      public Transit createNewTransit​(String systemName, String userName)
      Create a new Transit if the Transit does not exist.
      systemName - the desired system name
      userName - the desired user name
      a new Transit or null if a Transit with the same systemName or userName already exists, or if there is trouble creating a new Transit
    • createNewTransit

      public Transit createNewTransit​(String userName)
      For use with User GUI, to allow the auto generation of systemNames, where the user can optionally supply a username.

      Note: Since system names should be kept short for use in Dispatcher, automatically generated system names are in the form IZnn, where nn is the first available number.

      userName - the desired user name
      a new Transit or null if userName is already associated with another Transit
    • getTransit

      public Transit getTransit​(String name)
      Get an existing Transit. First looks up assuming that name is a User Name. If this fails looks up assuming that name is a System Name. If both fail, returns null.
      name - User name or system name to match
      null if no match found
    • deleteTransit

      public void deleteTransit​(Transit z)
      Remove an existing Transit.
      z - the transit to remove
    • getListUsingSection

      Get a list of Transits which use a specified Section.
      s - the section to check Transits against
      a list, possibly empty, of Transits using s
    • getListUsingBlock

    • getListEntryBlock

    • getBeanTypeHandled

      @Nonnull public String getBeanTypeHandled​(boolean plural)
      Description copied from interface: Manager
      Get the user-readable name of the type of NamedBean handled by this manager.

      For instance, in the code where we are dealing with just a bean and a message that needs to be passed to the user or in a log.

      Specified by:
      getBeanTypeHandled in interface Manager<Transit>
      plural - true to return plural form of the type; false to return singular form
      a string of the bean type that the manager handles, eg Turnout, Sensor etc
    • getNamedBeanClass

      Get the class of NamedBean supported by this Manager. This should be the generic class used in the Manager's class declaration.
      Specified by:
      getNamedBeanClass in interface Manager<Transit>
      the class supported by this Manager.