Package jmri

Enum SpeedStepMode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<SpeedStepMode>

    @Immutable
    public enum SpeedStepMode
    extends java.lang.Enum<SpeedStepMode>
    DCC Speed Step Mode.
    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.

    • Field Detail

      • name

        public final java.lang.String name
      • numSteps

        public final int numSteps
        The Number of steps, e.g. 126 for DCC 128
      • increment

        public final float increment
        The increment between steps, e.g. 1 / 126 for DCC 128
      • description

        public final java.lang.String description
    • Method Detail

      • values

        public static SpeedStepMode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (SpeedStepMode c : SpeedStepMode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static SpeedStepMode valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • toString

        public java.lang.String toString()
        Get a locale friendly Step Mode Description. For just "128" use name()
        Overrides:
        toString in class java.lang.Enum<SpeedStepMode>
        Returns:
        e.g. "128 SS"
      • getByName

        public static SpeedStepMode getByName​(java.lang.String name)
        Convert a human-readable string to a DCC speed step mode.
        Parameters:
        name - string version of speed step mode; example "128"
        Returns:
        matching SpeedStepMode
        Throws:
        java.lang.IllegalArgumentException - if name does not correspond to a valid speed step mode.
      • getByDescription

        public static SpeedStepMode getByDescription​(java.lang.String name)
        Convert a localized name string to a DCC speed step mode.
        Parameters:
        name - localized string version of speed step mode; example "128"
        Returns:
        matching SpeedStepMode
        Throws:
        java.lang.IllegalArgumentException - if name does not correspond to a valid speed step mode.