Package jmri

Interface SignalMastManager

    • Method Detail

      • dispose

        void dispose()
        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<SignalMast>
      • getSignalMast

        @CheckForNull
        SignalMast getSignalMast​(@Nonnull
                                 java.lang.String name)
        Get an existing SignalMast or return null if it doesn't exist. Locates via user name, then system name if needed.
        Parameters:
        name - User name or system name to match
        Returns:
        null if no match found
      • provideSignalMast

        @Nonnull
        SignalMast provideSignalMast​(@Nonnull
                                     java.lang.String name)
                              throws java.lang.IllegalArgumentException
        Get the SignalMast with the user name, then system name if needed; if that fails, create a new SignalMast. If the name is a valid system name, it will be used for the new SignalMast.
        Parameters:
        name - User name, system name, or address which can be promoted to system name
        Returns:
        never null
        Throws:
        java.lang.IllegalArgumentException - if SignalMast doesn't already exist and the manager cannot create the SignalMast due to an illegal name or name that can't be parsed
      • provideCustomSignalMast

        @Nonnull
        SignalMast provideCustomSignalMast​(@Nonnull
                                           java.lang.String systemName,
                                           java.lang.Class<? extends SignalMast> mastClass)
                                    throws JmriException
        Retrieve or create a new signal mast with a given system name. If a new object is created, it is also registered in this manager.
        Parameters:
        systemName - the system name by which to look up the mast, or to create anew.
        mastClass - specific signal mast class. Must have a single-argument string constructor to crete it by system name.
        Returns:
        a registered signal mast (might be newly created),
        Throws:
        JmriException - if a signal mast with the given system name is already registered but it is not of the correct class, or an internal error happens during construction.