Package javax.measure.quantity

[OPTIONAL] Provides quantitative properties or attributes of thing such as mass, time, distance, heat, and angular separation.

See: Description

Package javax.measure.quantity Description

[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 sensor ...;
Temperature temp = sensor.getValue();

// A vector of velocity in a three-dimensional space.
Unit = metrePerSecond = METRE.divide(SECOND);
Vector3D 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.6
Author:
Jean-Marie Dautelle, Werner Keil

Copyright © 2014–2016 Jean-Marie Dautelle, Werner Keil, V2COM. All rights reserved.