Interface UnitEnum<T>

All Known Subinterfaces:
UnitEnumHasShortUnit<T>
All Known Implementing Classes:
DistanceUnit, PressureUnit, TemperatureUnit, WeightUnit

public interface UnitEnum<T>
This is a tag interface identifying that the tagged enumeration is a definition of units of measure of some sort.
Author:
Andrew Pavlin, KA2DDO
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    from(T other)
    Get the multiplicative conversion factor to convert a value from the specified units to this unit.
    float
    getOffset(T other)
    Get the additive offset to convert a value from the specified unit to this unit.
  • Method Details

    • from

      float from(T other)
      Get the multiplicative conversion factor to convert a value from the specified units to this unit.
      Parameters:
      other - another T representing the existing units of a value
      Returns:
      the conversion factor to change a value into this unit
    • getOffset

      float getOffset(T other)
      Get the additive offset to convert a value from the specified unit to this unit.
      Parameters:
      other - another T representing the existing units of a value
      Returns:
      the offset (after multiplying by the from() factor) to add to get the value in this unit