Package jmri
Enum SpeedStepMode
- java.lang.Object
-
- java.lang.Enum<SpeedStepMode>
-
- jmri.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.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INCREMENTAL
MOTOROLA_28
NMRA_DCC_128
NMRA_DCC_14
NMRA_DCC_27
NMRA_DCC_28
TMCC_200
TMCC_32
UNKNOWN
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
description
float
increment
The increment between steps, e.g. 1 / 126 for DCC 128java.lang.String
name
int
numSteps
The Number of steps, e.g. 126 for DCC 128
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SpeedStepMode
bestCompatibleMode(java.util.EnumSet<SpeedStepMode> command_station_modes, java.util.EnumSet<SpeedStepMode> decoder_modes)
static SpeedStepMode
bestMode(java.util.EnumSet<SpeedStepMode> modes)
static SpeedStepMode
getByDescription(java.lang.String name)
Convert a localized name string to a DCC speed step mode.static SpeedStepMode
getByName(java.lang.String name)
Convert a human-readable string to a DCC speed step mode.static java.util.EnumSet<SpeedStepMode>
getCompatibleModes(java.util.EnumSet<SpeedStepMode> command_station_modes, java.util.EnumSet<SpeedStepMode> decoder_modes)
static java.util.EnumSet<SpeedStepMode>
getCompatibleModesForProtocol(LocoAddress.Protocol protocol)
java.lang.String
toString()
Get a locale friendly Step Mode Description.static SpeedStepMode
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static SpeedStepMode[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
UNKNOWN
public static final SpeedStepMode UNKNOWN
-
NMRA_DCC_128
public static final SpeedStepMode NMRA_DCC_128
-
NMRA_DCC_28
public static final SpeedStepMode NMRA_DCC_28
-
NMRA_DCC_27
public static final SpeedStepMode NMRA_DCC_27
-
NMRA_DCC_14
public static final SpeedStepMode NMRA_DCC_14
-
MOTOROLA_28
public static final SpeedStepMode MOTOROLA_28
-
TMCC_32
public static final SpeedStepMode TMCC_32
-
TMCC_200
public static final SpeedStepMode TMCC_200
-
INCREMENTAL
public static final SpeedStepMode INCREMENTAL
-
-
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 namejava.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 classjava.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.
-
getCompatibleModes
public static java.util.EnumSet<SpeedStepMode> getCompatibleModes(java.util.EnumSet<SpeedStepMode> command_station_modes, java.util.EnumSet<SpeedStepMode> decoder_modes)
-
bestCompatibleMode
public static SpeedStepMode bestCompatibleMode(java.util.EnumSet<SpeedStepMode> command_station_modes, java.util.EnumSet<SpeedStepMode> decoder_modes)
-
bestMode
public static SpeedStepMode bestMode(java.util.EnumSet<SpeedStepMode> modes)
-
getCompatibleModesForProtocol
public static java.util.EnumSet<SpeedStepMode> getCompatibleModesForProtocol(LocoAddress.Protocol protocol)
-
-