Interface QuantityUnitMeasure<T extends Enum>

All Known Implementing Classes:
Length, Weight

public interface QuantityUnitMeasure<T extends Enum>
This interface tags a class that contains a magnitude value and unit thereof. All such classes must provide a one-arg constructor that takes a float primitive.
Author:
Andrew Pavlin, KA2DDO
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Get the magnitude of this value in its unit.
    float
    Get this length in the specified units.
    float
    Get the magnitude of this value in the default unit for the value class, scaling it if stored in a different unit.
    Get the unit in which the magnitude is measured.
  • Method Details

    • getUnit

      T getUnit()
      Get the unit in which the magnitude is measured.
      Returns:
      UnitEnum of the unit
    • getMagnitude

      float getMagnitude()
      Get the magnitude of this value in its unit.
      Returns:
      float value
    • getMagnitudeInDefaultUnit

      float getMagnitudeInDefaultUnit()
      Get the magnitude of this value in the default unit for the value class, scaling it if stored in a different unit.
      Returns:
      float value
    • getMagnitude

      float getMagnitude(T unit)
      Get this length in the specified units.
      Parameters:
      unit - UnitEnum for scaling the value
      Returns:
      float value converted to the specified units