Interface QuantityFactory<Q extends Quantity<Q>>

Type Parameters:
Q - the type of the Quantity result

public interface QuantityFactory<Q extends Quantity<Q>>
Represents a factory that accepts Number and Unit arguments to create Quantity results.
Since:
1.0
Version:
1.4, December 18, 2018
Author:
Werner Keil, Otavio Santana
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    create(Number value, Unit<Q> unit)
    Returns the quantity for the specified number stated in the specified unit.
    create(Number value, Unit<Q> unit, Quantity.Scale scale)
    Returns the quantity for the specified number stated in the specified unit and scale.
    Returns the system unit for quantities produced by this factory or null if unknown.
  • Method Details

    • create

      Quantity<Q> create(Number value, Unit<Q> unit, Quantity.Scale scale)
      Returns the quantity for the specified number stated in the specified unit and scale.
      Parameters:
      value - the numeric value stated in the specified unit
      unit - the unit
      scale - The ABSOLUTE / RELATIVE scale of this quantity
      Returns:
      the corresponding quantity
      Since:
      2.0
    • create

      Quantity<Q> create(Number value, Unit<Q> unit)
      Returns the quantity for the specified number stated in the specified unit.
      Parameters:
      value - the numeric value stated in the specified unit
      unit - the unit
      Returns:
      the corresponding quantity
    • getSystemUnit

      Returns the system unit for quantities produced by this factory or null if unknown.

      Because the system unit is unique by quantity type, it can be be used to identify the quantity given the unit. For example:

           static boolean isAngularSpeed(Unit<?> unit) {
               return unit.getSystemUnit().equals(RADIAN.divide(SECOND));
           }
           assert isAngularSpeed(REVOLUTION.divide(MINUTE)); // Returns true.
       
      Returns:
      the system unit for this factory.
      See Also: