Class Units

java.lang.Object
edu.wpi.first.units.Units

public final class Units extends Object
Contains a set of predefined units.
  • Field Details

  • Method Details

    • Milli

      public static <U extends Unit> U Milli(U baseUnit, String name, String symbol)
      Creates a unit equal to a thousandth of the base unit, eg Milliseconds = Milli(Units.Seconds).
      Type Parameters:
      U - the type of the unit
      Parameters:
      baseUnit - the unit being derived from. This does not have to be the base unit of measure
      name - the name of the new derived unit
      symbol - the symbol of the new derived unit
      Returns:
      the milli-unit
    • Milli

      public static <U extends Unit> U Milli(U baseUnit)
      Creates a unit equal to a thousandth of the base unit, eg Milliseconds = Milli(Units.Seconds).
      Type Parameters:
      U - the type of the unit
      Parameters:
      baseUnit - the unit being derived from. This does not have to be the base unit of measure
      Returns:
      the milli-unit
    • Micro

      public static <U extends Unit> U Micro(U baseUnit, String name, String symbol)
      Creates a unit equal to a millionth of the base unit, eg Microseconds = Micro(Units.Seconds, "Microseconds", 'us").
      Type Parameters:
      U - the type of the unit
      Parameters:
      baseUnit - the unit being derived from. This does not have to be the base unit of measure
      name - the name of the new derived unit
      symbol - the symbol of the new derived unit
      Returns:
      the micro-unit
    • Micro

      public static <U extends Unit> U Micro(U baseUnit)
      Creates a unit equal to a millionth of the base unit, eg Microseconds = Micro(Units.Seconds).
      Type Parameters:
      U - the type of the unit
      Parameters:
      baseUnit - the unit being derived from. This does not have to be the base unit of measure
      Returns:
      the micro-unit
    • Kilo

      public static <U extends Unit> U Kilo(U baseUnit, String name, String symbol)
      Creates a unit equal to a thousand of the base unit, eg Kilograms = Kilo(Units.Grams).
      Type Parameters:
      U - the type of the unit
      Parameters:
      baseUnit - the unit being derived from. This does not have to be the base unit of measure
      name - the name of the new derived unit
      symbol - the symbol of the new derived unit
      Returns:
      the kilo-unit
    • Kilo

      public static <U extends Unit> U Kilo(U baseUnit)
      Creates a unit equal to a thousand of the base unit, eg Kilograms = Kilo(Units.Grams).
      Type Parameters:
      U - the type of the unit
      Parameters:
      baseUnit - the unit being derived from. This does not have to be the base unit of measure
      Returns:
      the kilo-unit
    • derive

      public static <U extends Unit> UnitBuilder<U> derive(U unit)
      Creates a new unit builder object based on a given input unit. The builder can be used to fluently describe a new unit in terms of its relation to the base unit.
      Type Parameters:
      U - the dimension of the unit to derive
      Parameters:
      unit - the base unit from which to derive a new unit
      Returns:
      a builder object