Package javax.measure.quantity

[OPTIONAL] Provides quantitative properties or attributes of thing such as mass, time, distance, heat, and angular separation. Quantities of different kinds are represented by sub-types of the Quantity interface.

Only quantities defined in the BIPM - SI Brochure are provided here. Users can create their own quantity types by extending the Quantity interface.

This package supports measurable quantities, which can be expressed as (Number, Unit) tuples. Those tuples are not necessarily used directly in numerically intensive code. They are more useful as meta-data converted to the application internal representation (for example double primitive type with the requirement to provide values in meters) before computation begins.

Quantity sub-types are also used as parameterized type to characterize generic classes and provide additional compile time check. This technique is used extensively by the Unit interface, but users can apply the same approach to their own classes. In the example below, Sensor, MyQuantity and Vector3D are user-defined classes:

// A general-purpose Sensor class used for temperature measurements:
Sensor<Temperature> sensor ...;
Temperature temp = sensor.getValue();

// A vector of velocity in a three-dimensional space.
Unit<Speed> = metrePerSecond = METRE.divide(SECOND);
Vector3D<Speed> aircraftSpeed = new Vector3D(200.0, 50.0, -0.5, metrePerSecond);

This package holds only the quantities required by the metric system.

Since:
1.0
Version:
2.8
Author:
Jean-Marie Dautelle, Werner Keil
See Also:
Wikipedia: International System of Units, Wikipedia: 2019 redefinition of the SI base units
Skip navigation links

Copyright © 2014–2019 Jean-Marie Dautelle, Werner Keil, Otavio Santana. All rights reserved.