Class SpeedStepScaleSpeedMatcher

java.lang.Object
jmri.jmrix.bachrus.speedmatcher.SpeedMatcher
jmri.jmrix.bachrus.speedmatcher.speedStepScale.SpeedStepScaleSpeedMatcher
All Implemented Interfaces:
EventListener, ProgListener, ThrottleListener
Direct Known Subclasses:
SpeedStepScaleESUTableSpeedMatcher, SpeedStepScaleSpeedTableSpeedMatcher

public abstract class SpeedStepScaleSpeedMatcher extends SpeedMatcher
Abstract class defining the basic operations of a Speed Step Scale speed matcher (sets up the complex speed table such that the speed step equals the locomotive speed when using "128" speed step mode). All speed step scale speed matcher implementations must extend this class.
  • Field Details

  • Constructor Details

  • Method Details

    • validate

      protected boolean validate()
      Validates the speed matcher's configuration
      Specified by:
      validate in class SpeedMatcher
      Returns:
      true if the configuration is valid, false otherwise
    • getSpeedStepScaleSpeedInKPH

      protected float getSpeedStepScaleSpeedInKPH(int speedStep)
      Gets the speed in KPH for a given speed step for a speed step scale speed matcher
      Parameters:
      speedStep - the int speed step to get the speed for
      Returns:
      speed for the given speedStep in KPH
    • getSpeedStepLinearValue

      protected int getSpeedStepLinearValue(int speedStep)
      Gets the speed step value for a linear speed table
      Parameters:
      speedStep - the inst speed step to get the value for
      Returns:
      value for the speed step
    • getSpeedForSpeedTableStep

      public static float getSpeedForSpeedTableStep(int speedStep)
      Gets the 128 speed step mode speed for a speed table step
      Parameters:
      speedStep - the int speed table step to get the 128 speed step mode speed for
      Returns:
      the 128 speed step mode speed for the given speedStep
    • getNextLowestSpeedTableStepForSpeed

      public static int getNextLowestSpeedTableStepForSpeed(float speed)
      Gets the next lowest speed table step for the given speed
      Parameters:
      speed - float speed in the user facing unit
      Returns:
      the next lowest int speed table step for the given speed