Skip to content
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.

Latest commit

 

History

History
16 lines (11 loc) · 1.12 KB

units.md

File metadata and controls

16 lines (11 loc) · 1.12 KB

Units

The Units class extends AbstractSystemOfUnits and provides a set of a set of static constants for the most common units defined by SI/BIPM, see Supported Units .

Metric Prefix

MetricPrefix is provided for obtaining multiples or submultiples of system units. Method names mirror SI / Metric prefix names but are uppercase like it's common to constants in Java. MetricPrefix is a "hybrid" enum, defining the constant factors as enumeration elements, but doing the actual conversion via matching static method names like CENTI, MEGA, etc.

Examples:

Unit<Length> m  = Units.METRE;
Unit<Length> km = MetricPrefix.KILO(Units.METRE);
Unit<Energy> kW = MetricPrefix.KILO(Units.WATT);

Unit instances returned by one of these methods provide type safety through unit parameterization (the and type parameters). This feature was discussed in the Unit Parametrization chapter of the specification.