Package jmri

Class ProgrammingMode


  • @Immutable
    public final class ProgrammingMode
    extends java.lang.Object
    Denote a single programming mode.

    User code gets a list of available modes from the Programmer or AddressedProgrammer in use. It then selects a mode to use and indicates it via a setMode() call.

    A ProgrammingMode has a user-readable name to help humans select it.

    We define a number of modes as constants because they are common across so many DCC-specific implementations, they've become defacto standards.

    More specific definitions (and Bundle entries) should retreat to specific Programmer implementations. The whole idea is to have code deal with the modes that a specific Programmer provides, not make assumptions about global values.

    See Also:
    Programmer
    • Field Detail

      • OPSBITMODE

        public static final ProgrammingMode OPSBITMODE
        NMRA "Operations" or "Programming on the main" mode, using only the bit-wise operations
      • OPSACCEXTBYTEMODE

        public static final ProgrammingMode OPSACCEXTBYTEMODE
        NMRA "Programming on the main" mode for stationary decoders, using only the byte-wise operations and "extended" addressing.
      • OPSACCBITMODE

        public static final ProgrammingMode OPSACCBITMODE
        NMRA "Programming on the main" mode for stationary decoders, using only the bit-wise operations. Note that this is defined as using the "normal", not "extended" addressing.
      • OPSACCEXTBITMODE

        public static final ProgrammingMode OPSACCEXTBITMODE
        NMRA "Programming on the main" mode for stationary decoders, using only the bit-wise operations and "extended" addressing.
      • OPSACCBYTEMODE

        public static final ProgrammingMode OPSACCBYTEMODE
        NMRA "Programming on the main" mode for stationary decoders, using only the byte-wise operations. Note that this is defined as using the "normal", not "extended" addressing.
      • ADDRESSMODE

        public static final ProgrammingMode ADDRESSMODE
        NMRA "Address-only" mode. Often implemented as a proper subset of "Register" mode, as the underlying operation is the same.
      • OPSBYTEMODE

        public static final ProgrammingMode OPSBYTEMODE
        NMRA "Operations" or "Programming on the main" mode, using only the byte-wise operations.
      • DIRECTMODE

        public static final ProgrammingMode DIRECTMODE
        NMRA "Direct" mode, using both the bit-wise and byte-wise operations.
    • Constructor Detail

      • ProgrammingMode

        public ProgrammingMode​(@Nonnull
                               java.lang.String standardName)
        Create a ProgrammingMode instance.
        Parameters:
        standardName - a name, not to be translated, for internal use
      • ProgrammingMode

        public ProgrammingMode​(@Nonnull
                               java.lang.String standardName,
                               @Nonnull
                               java.lang.String localName)
        Create an instance with a provided localized name.

        This is useful when creating a ProgrammingMode deep within some system-specific code, and translations cannot be added to the top-level jmri.Bundle.

        Parameters:
        standardName - a name, not to be translated, for internal use
        localName - a localized, human-readable name for the mode
    • Method Detail

      • toString

        @Nonnull
        public java.lang.String toString()
        Display the localized (human readable) name.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the localized name
      • getStandardName

        @Nonnull
        public java.lang.String getStandardName()
        Return the standard (not localized, human readable) name.
        Returns:
        the standard name
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object