Package org.unitsofmeasurement.quantity

Provides quantitative properties such as mass, time, distance, heat, and angular separation.

See: Description

Package org.unitsofmeasurement.quantity Description

Provides quantitative properties such as mass, time, distance, heat, and angular separation. Quantities of different kinds are represented by sub-types of the Quantity interface. This package provides sub-types for the quantities defined in the International System of Units (SI), together with a few non-SI quantities. 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 expected to be used directly in numerically intensive code. They are more useful as metadata converted to the application internal representation (for example double primitive type with the requirement to provide values in metres) before computation begins.

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

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

    // Velocity vector (a vector of speeds) in a three-dimensional space.
    Unit<Speed> = metrePerSecond = METRE.divide(SECOND);
    Vector3D<Speed> aircraftSpeed = new Vector3D(200.0, 50.0, -0.5, metrePerSecond);
Definition of terms
This package adopts the definitions provided by the International vocabulary of metrology, with some adaptations:

Jean-Marie Dautelle, Werner Keil
See Also:
Quantity, International vocabulary of metrology

Copyright © 2005–2014 Units of Measurement project. All rights reserved.