Interface UnitsConverter.UnitInterface

All Known Implementing Classes:
UnitsConverter.DistanceUnit, UnitsConverter.HumidityUnit, UnitsConverter.MassUnit, UnitsConverter.PressureUnit, UnitsConverter.TemperatureUnit
Enclosing class:
UnitsConverter

public static interface UnitsConverter.UnitInterface
Interface unit enums must implement.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    getSiValue(double value)
    Converts value in units method is called for to value in SI units.
    Gets the unit symbol.
    Gets the unit by provided name.
    double
    getValue(double siValue)
    Converts SI value to value in units it is called for.
    int
    Gets the item order ID.
  • Method Details

    • getUnit

      String getUnit()
      Gets the unit symbol.
      Returns:
      unit symbol.
    • getValue

      double getValue(double siValue)
      Converts SI value to value in units it is called for.
      Parameters:
      siValue - value in SI units.
      Returns:
      value in units method is called for.
    • getSiValue

      double getSiValue(double value)
      Converts value in units method is called for to value in SI units.
      Parameters:
      value - value in units method is called for.
      Returns:
      value in SI units.
    • ordinal

      int ordinal()
      Gets the item order ID. Implemented by enum by default.
      Returns:
      Returns the item order ID.
    • getUnitByName

      UnitsConverter.UnitInterface getUnitByName(String name)
      Gets the unit by provided name. First character is skipped in comparison. It is to prevent checking non-basic units.
      Parameters:
      name - full unit name.
      Returns:
      UnitsConverter.UnitInterface object of specified quantity, that has given unit.