Enum Class SpeedUnit

java.lang.Object
java.lang.Enum<SpeedUnit>
com.irurueta.units.SpeedUnit
All Implemented Interfaces:
Serializable, Comparable<SpeedUnit>, Constable

public enum SpeedUnit extends Enum<SpeedUnit>
Enumerator containing recognized typical speed units.
  • Enum Constant Details

    • METERS_PER_SECOND

      public static final SpeedUnit METERS_PER_SECOND
      Meters per second (m/s).
    • KILOMETERS_PER_HOUR

      public static final SpeedUnit KILOMETERS_PER_HOUR
      Kilometers per hour (Km/h)
    • KILOMETERS_PER_SECOND

      public static final SpeedUnit KILOMETERS_PER_SECOND
      Kilometers per second (Km/s)
    • FEET_PER_SECOND

      public static final SpeedUnit FEET_PER_SECOND
      Feet per second (ft/s)
    • MILES_PER_HOUR

      public static final SpeedUnit MILES_PER_HOUR
      Miles per hour (mph)
  • Constructor Details

    • SpeedUnit

      private SpeedUnit()
  • Method Details

    • values

      public static SpeedUnit[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SpeedUnit valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getUnitSystem

      public static UnitSystem getUnitSystem(SpeedUnit unit)
      Returns unit system for provided speed unit.
      Parameters:
      unit - speed unit to be checked.
      Returns:
      unit system (metric or imperial).
      Throws:
      IllegalArgumentException - if unit is null or not supported.
    • getMetricUnits

      public static SpeedUnit[] getMetricUnits()
      Gets all supported metric speed units.
      Returns:
      all supported metric speed units.
    • getImperialUnits

      public static SpeedUnit[] getImperialUnits()
      Gets all supported imperial speed units.
      Returns:
      all supported imperial speed units.
    • isMetric

      public static boolean isMetric(SpeedUnit unit)
      Indicates whether provided unit belongs to the metric unit system.
      Parameters:
      unit - speed unit to be checked.
      Returns:
      true if unit belongs to metric unit system.
      Throws:
      IllegalArgumentException - if unit is null or not supported.
    • isImperial

      public static boolean isImperial(SpeedUnit unit)
      Indicates whether provided unit belongs to the imperial unit system.
      Parameters:
      unit - speed unit to be checked.
      Returns:
      true if unit belongs to imperial unit system.
      Throws:
      IllegalArgumentException - if unit is null or not supported.