001/*
002 * Units of Measurement Systems for Java
003 * Copyright (c) 2005-2017, Jean-Marie Dautelle, Werner Keil and others.
004 *
005 * All rights reserved.
006 *
007 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
008 *
009 * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
010 *
011 * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
012 *
013 * 3. Neither the name of JSR-363, Units of Measurement nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission.
014 *
015 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
016 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
017 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
018 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
019 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
020 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
021 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
022 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
023 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
024 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
025 */
026package systems.uom.ucum;
027
028import static tec.uom.se.unit.MetricPrefix.*;
029import static tec.uom.se.AbstractUnit.ONE;
030import si.uom.quantity.*;
031import systems.uom.quantity.*;
032import si.uom.SI;
033import tec.uom.se.*;
034import tec.uom.se.format.SimpleUnitFormat;
035import tec.uom.se.function.LogConverter;
036import tec.uom.se.function.PiMultiplierConverter;
037import tec.uom.se.unit.AlternateUnit;
038import tec.uom.se.unit.ProductUnit;
039import tec.uom.se.unit.Units;
040
041import javax.measure.Quantity;
042import javax.measure.Unit;
043import javax.measure.quantity.*;
044
045/**
046 * <p>
047 * This class contains {@link SI} and Non-SI units as defined in the
048 * <a href="http://unitsofmeasure.org/"> Unified Code for Units of Measure</a>.
049 * </p>
050 *
051 * <p>
052 * Compatibility with {@link SI} units has been given priority over strict
053 * adherence to the standard. We have attempted to note every place where the
054 * definitions in this class deviate from the UCUM standard, but such notes are
055 * likely to be incomplete.
056 * </p>
057 *
058 * @author <a href="mailto:eric-r@northwestern.edu">Eric Russell</a>
059 * @author <a href="mailto:units@catmedia.us">Werner Keil</a>
060 * @see <a href="http://www.unitsofmeasure.org">UCUM</a>
061 * @version 0.7.7, $Date: 2017-04-06 $
062 */
063public final class UCUM extends AbstractSystemOfUnits {
064
065    /**
066     * The singleton instance.
067     */
068    private static final UCUM INSTANCE = new UCUM();
069
070    /**
071     * Default constructor (prevents this class from being instantiated).
072     */
073    private UCUM() {
074    }
075
076    /**
077     * Returns the singleton instance of this class.
078     *
079     * @return the UCUM system instance.
080     */
081    public static UCUM getInstance() {
082        return INSTANCE;
083    }
084
085    //////////////////////////////
086    // BASE UNITS: UCUM 4.2 §28 //
087    //////////////////////////////
088    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
089    public static final Unit<Length> METER = addUnit(Units.METRE);
090    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
091    public static final Unit<Time> SECOND = addUnit(Units.SECOND);
092    /**
093     * We deviate slightly from the standard here, to maintain compatibility
094     * with the existing SI units. In UCUM, the gram is the base unit of mass,
095     * rather than the kilogram. This doesn't have much effect on the units
096     * themselves, but it does make formatting the units a challenge.
097     */
098    public static final Unit<Mass> GRAM = addUnit(Units.GRAM);
099    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
100    public static final Unit<Angle> RADIAN = addUnit(Units.RADIAN);
101    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
102    public static final Unit<Temperature> KELVIN = addUnit(Units.KELVIN);
103    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
104    public static final Unit<ElectricCharge> COULOMB = addUnit(Units.COULOMB);
105    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
106    public static final Unit<LuminousIntensity> CANDELA = addUnit(Units.CANDELA);
107
108    ///////////////////////////////////////////////
109    // DIMENSIONLESS DERIVED UNITS: UCUM 4.3 §29 //
110    ///////////////////////////////////////////////
111    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
112    public static final Unit<Dimensionless> TRILLIONS = addUnit(ONE.multiply(1000000000000L));
113    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
114    public static final Unit<Dimensionless> BILLIONS = addUnit(ONE.multiply(1000000000));
115    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
116    public static final Unit<Dimensionless> MILLIONS = addUnit(ONE.multiply(1000000));
117    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
118    public static final Unit<Dimensionless> THOUSANDS = addUnit(ONE.multiply(1000));
119    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
120    public static final Unit<Dimensionless> HUNDREDS = addUnit(ONE.multiply(100));
121    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
122    public static final Unit<Dimensionless> PI = addUnit(ONE.transform(new PiMultiplierConverter()));
123    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
124    public static final Unit<Dimensionless> PERCENT = addUnit(ONE.divide(100));
125    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
126    public static final Unit<Dimensionless> PER_THOUSAND = addUnit(ONE.divide(1000));
127    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
128    public static final Unit<Dimensionless> PER_MILLION = addUnit(ONE.divide(1000000));
129    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
130    public static final Unit<Dimensionless> PER_BILLION = addUnit(ONE.divide(1000000000));
131    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
132    public static final Unit<Dimensionless> PER_TRILLION = addUnit(ONE.divide(1000000000000L));
133    ////////////////////////////
134    // SI UNITS: UCUM 4.3 §30 //
135    ////////////////////////////
136    /**
137     * We deviate slightly from the standard here, to maintain compatibility
138     * with the existing SI units. In UCUM, the mole is no longer a base unit,
139     * but is defined as <code>Unit.ONE.multiply(6.0221367E23)</code>.
140     */
141    public static final Unit<AmountOfSubstance> MOLE = addUnit(Units.MOLE);
142    /**
143     * We deviate slightly from the standard here, to maintain compatibility
144     * with the existing SI units. In UCUM, the steradian is defined as
145     * <code>RADIAN.pow(2)</code>.
146     */
147    public static final Unit<SolidAngle> STERADIAN = addUnit(Units.STERADIAN);
148    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
149    public static final Unit<Frequency> HERTZ = addUnit(Units.HERTZ);
150    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
151    public static final Unit<Force> NEWTON = addUnit(Units.NEWTON);
152    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
153    public static final Unit<Pressure> PASCAL = addUnit(Units.PASCAL);
154    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
155    public static final Unit<Energy> JOULE = addUnit(Units.JOULE);
156    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
157    public static final Unit<Power> WATT = addUnit(Units.WATT);
158    /**
159     * We deviate slightly from the standard here, to maintain compatibility
160     * with the existing SI units. In UCUM, the ampere is defined as
161     * <code>COULOMB.divide(SECOND)</code>.
162     */
163    public static final Unit<ElectricCurrent> AMPERE = addUnit(Units.AMPERE);
164    // public static final Unit<MagnetomotiveForce> AMPERE_TURN =
165    // addUnit(Units.AMPERE_TURN);
166    /**
167     * We deviate slightly from the standard here, to maintain compatibility
168     * with the existing SI units. In UCUM, the volt is defined as
169     * <code>JOULE.divide(COULOMB)</code>.
170     */
171    public static final Unit<ElectricPotential> VOLT = addUnit(Units.VOLT);
172    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
173    public static final Unit<ElectricCapacitance> FARAD = addUnit(Units.FARAD);
174    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
175    public static final Unit<ElectricResistance> OHM = addUnit(Units.OHM);
176    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
177    public static final Unit<ElectricConductance> SIEMENS = addUnit(Units.SIEMENS);
178    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
179    public static final Unit<MagneticFlux> WEBER = addUnit(Units.WEBER);
180    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
181    public static final Unit<Temperature> CELSIUS = addUnit(Units.CELSIUS);
182    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
183    public static final Unit<MagneticFluxDensity> TESLA = addUnit(Units.TESLA);
184    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
185    public static final Unit<ElectricInductance> HENRY = addUnit(Units.HENRY);
186    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
187    public static final Unit<LuminousFlux> LUMEN = addUnit(Units.LUMEN);
188    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
189    public static final Unit<Illuminance> LUX = addUnit(Units.LUX);
190    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
191    public static final Unit<Radioactivity> BECQUEREL = addUnit(Units.BECQUEREL);
192    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
193    public static final Unit<RadiationDoseAbsorbed> GRAY = addUnit(Units.GRAY);
194    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
195    public static final Unit<RadiationDoseEffective> SIEVERT = addUnit(Units.SIEVERT);
196
197    ///////////////////////////////////////////////////////////////////////
198    // OTHER UNITS FROM ISO 1000, ISO 2955, AND ANSI X3.50: UCUM 4.3 §31 //
199    ///////////////////////////////////////////////////////////////////////
200    // The order of GON and DEGREE has been inverted because GON is defined in
201    // terms of DEGREE
202    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
203    public static final Unit<Angle> DEGREE = addUnit(new ProductUnit<Angle>(PI.multiply(RADIAN.divide(180))));
204    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
205    public static final Unit<Angle> GRADE = addUnit(DEGREE.multiply(0.9));
206    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
207    public static final Unit<Angle> GON = GRADE;
208    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
209    public static final Unit<Angle> MINUTE_ANGLE = addUnit(DEGREE.divide(60));
210    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
211    public static final Unit<Angle> SECOND_ANGLE = addUnit(MINUTE_ANGLE.divide(60));
212    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
213    public static final Unit<Volume> LITER = addUnit(Units.LITRE);
214    /**
215     * As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. Liter has
216     * <b>two</b> definitions.
217     * 
218     * @see <a href="http://unitsofmeasure.org/ucum.html#iso1000">UCUM Table
219     *      5</a>
220     */
221    public static final Unit<Volume> LITER_DM3 = addUnit(DECI(Units.CUBIC_METRE));
222    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
223    public static final Unit<Area> ARE = addUnit(Units.SQUARE_METRE.multiply(100));
224    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
225    public static final Unit<Time> MINUTE = addUnit(Units.MINUTE);
226    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
227    public static final Unit<Time> HOUR = addUnit(Units.HOUR);
228    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
229    public static final Unit<Time> DAY = addUnit(Units.DAY);
230    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
231    public static final Unit<Time> YEAR_TROPICAL = addUnit(Units.DAY.multiply(365.24219));
232    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
233    public static final Unit<Time> YEAR_JULIAN = addUnit(Units.DAY.multiply(365.25));
234    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
235    public static final Unit<Time> YEAR_GREGORIAN = addUnit(Units.DAY.multiply(365.2425));
236    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
237    public static final Unit<Time> YEAR = addUnit(Units.DAY.multiply(365.25));
238    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
239    public static final Unit<Time> WEEK = addUnit(Units.DAY.multiply(7));
240    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
241    public static final Unit<Time> MONTH_SYNODAL = addUnit(Units.DAY.multiply(29.53059));
242    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
243    public static final Unit<Time> MONTH_JULIAN = addUnit(YEAR_JULIAN.divide(12));
244    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
245    public static final Unit<Time> MONTH_GREGORIAN = addUnit(YEAR_GREGORIAN.divide(12));
246    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
247    public static final Unit<Time> MONTH = addUnit(YEAR_JULIAN.divide(12));
248    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
249    public static final Unit<Mass> TONNE = addUnit(Units.KILOGRAM.multiply(1000));
250    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
251    public static final Unit<Pressure> BAR = addUnit(Units.PASCAL.multiply(100000));
252    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
253    public static final Unit<Mass> ATOMIC_MASS_UNIT = addUnit(SI.UNIFIED_ATOMIC_MASS);
254    // public static final Unit<Mass> ATOMIC_MASS_UNIT = addUnit(
255    // new AlternateUnit<Mass>(Units.UNIFIED_ATOMIC_MASS,
256    // Units.UNIFIED_ATOMIC_MASS.getSymbol()), Mass.class);
257    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
258    public static final Unit<Energy> ELECTRON_VOLT = addUnit(SI.ELECTRON_VOLT);
259    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
260    public static final Unit<Length> ASTRONOMIC_UNIT = addUnit(SI.ASTRONOMICAL_UNIT);
261    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
262    public static final Unit<Length> PARSEC = addUnit(Units.METRE.multiply(3.085678E16));
263
264    /////////////////////////////////
265    // NATURAL UNITS: UCUM 4.3 §32 //
266    /////////////////////////////////
267    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
268    public static final Unit<Speed> VELOCITY_OF_LIGHT = addUnit(Units.METRE_PER_SECOND.multiply(299792458));
269    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
270    public static final Unit<Action> PLANCK = addUnit(SI.JOULE_SECOND.multiply(6.6260755E-34));
271    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
272    public static final Unit<?> BOLTZMAN = addUnit(JOULE.divide(KELVIN).multiply(1.380658E-23));
273    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
274    public static final Unit<ElectricPermittivity> PERMITTIVITY_OF_VACUUM = addUnit(
275            SI.FARADS_PER_METRE.multiply(8.854187817E-12));
276    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
277    public static final Unit<MagneticPermeability> PERMEABILITY_OF_VACUUM = addUnit(
278            new ProductUnit<MagneticPermeability>(SI.NEWTON_PER_SQUARE_AMPERE.multiply(PI.multiply(4).divide(1E7))),
279            MagneticPermeability.class);
280    // public static final Unit<MagneticPermeability> PERMEABILITY_OF_VACUUM =
281    // addUnit(
282    // new ProductUnit<MagneticPermeability>(Units.NEWTONS_PER_SQUARE_AMPERE
283    // .multiply(PI).multiply(4).divide(1E7)),
284    // MagneticPermeability.class);
285    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
286    public static final Unit<ElectricCharge> ELEMENTARY_CHARGE = addUnit(
287            Units.COULOMB.transform(((AbstractUnit<Energy>) SI.ELECTRON_VOLT).getSystemConverter()));
288    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
289    public static final Unit<Mass> ELECTRON_MASS = addUnit(GRAM.multiply(9.1093897E-28));
290    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
291    public static final Unit<Mass> PROTON_MASS = addUnit(GRAM.multiply(1.6726231E-24));
292    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
293    public static final Unit<?> NEWTON_CONSTANT_OF_GRAVITY = addUnit(
294            METER.pow(3).multiply(Units.KILOGRAM.pow(-1)).multiply(SECOND.pow(-2)).multiply(6.67259E-11));
295    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
296    public static final Unit<Acceleration> ACCELLERATION_OF_FREEFALL = addUnit(
297            Units.METRE_PER_SQUARE_SECOND.multiply(9.80665));
298    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
299    public static final Unit<Pressure> ATMOSPHERE = addUnit(Units.PASCAL.multiply(101325));
300    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
301    public static final Unit<Length> LIGHT_YEAR = addUnit(
302            new ProductUnit<Length>(VELOCITY_OF_LIGHT.multiply(YEAR_JULIAN)));
303    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
304    public static final Unit<Force> GRAM_FORCE = addUnit(
305            new ProductUnit<Force>(GRAM.multiply(ACCELLERATION_OF_FREEFALL)));
306    // POUND_FORCE contains a forward reference to avoirdupois pound weight, so
307    // it has been moved after section §39 below
308
309    /////////////////////////////
310    // CGS UNITS: UCUM 4.3 §33 //
311    /////////////////////////////
312    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
313    public static final Unit<WaveNumber> KAYSER = addUnit(SI.RECIPROCAL_METRE.divide(100));
314    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
315    public static final Unit<Acceleration> GAL = addUnit(
316            new ProductUnit<Acceleration>(CENTI(METER).divide(SECOND.pow(2))));
317    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
318    public static final Unit<Force> DYNE = addUnit(
319            new ProductUnit<Force>(Units.GRAM.multiply(CENTI(Units.METRE).divide(Units.SECOND.pow(2)))));
320    // public static final Unit<Force> DYNE = addUnit(new ProductUnit<Force>(
321    // Units.GRAM.multiply(new
322    // ProductUnit(CENTI(Units.METRE)).divide(Units.SECOND
323    // .pow(2)))));
324    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
325    public static final Unit<Energy> ERG = addUnit(new ProductUnit<Energy>(DYNE.multiply(CENTI(Units.METRE))));
326    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
327    public static final Unit<DynamicViscosity> POISE = addUnit(
328            new ProductUnit<DynamicViscosity>(DYNE.multiply(SECOND).divide(CENTI(Units.METRE).pow(2))));
329    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
330    public static final Unit<ElectricCurrent> BIOT = addUnit(AMPERE.multiply(10));
331    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
332    public static final Unit<KinematicViscosity> STOKES = addUnit(
333            new ProductUnit<KinematicViscosity>(CENTI(Units.METRE).pow(2).divide(Units.SECOND)));
334    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
335    public static final Unit<MagneticFlux> MAXWELL = addUnit(Units.WEBER.divide(1E8));
336    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
337    public static final Unit<MagneticFluxDensity> GAUSS = addUnit(Units.TESLA.divide(1E4));
338    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
339    public static final Unit<MagneticFieldStrength> OERSTED = addUnit(
340            new ProductUnit<MagneticFieldStrength>(SI.AMPERE_PER_METRE.multiply(250).divide(PI)));
341    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
342    public static final Unit<MagnetomotiveForce> GILBERT = addUnit(
343            new ProductUnit<MagnetomotiveForce>(OERSTED.multiply(CENTI(Units.METRE))));
344    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
345    public static final Unit<Luminance> STILB = addUnit(
346            new ProductUnit<Luminance>(CANDELA.divide(CENTI(METER).pow(2))));
347    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
348    public static final Unit<Luminance> LAMBERT = addUnit(new ProductUnit<Luminance>(STILB.divide(PI)));
349    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
350    public static final Unit<Illuminance> PHOT = addUnit(LUX.divide(1E4));
351    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
352    public static final Unit<Radioactivity> CURIE = addUnit(Units.BECQUEREL.multiply(3.7E10));
353    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
354    public static final Unit<IonizingRadiation> ROENTGEN = addUnit(SI.COULOMBS_PER_KILOGRAM.multiply(2.58E-4));
355    // add later when JMQ issue fixed
356    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
357    public static final Unit<RadiationDoseAbsorbed> RAD = addUnit(
358            new ProductUnit<RadiationDoseAbsorbed>(ERG.divide(Units.GRAM.multiply(100))));
359    // public static final Unit<RadiationDoseAbsorbed> RAD = addUnit(new
360    // ProductUnit<RadiationDoseAbsorbed>(
361    // ERG.divide(Units.GRAM).multiply(100)));
362    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
363    public static final Unit<RadiationDoseEffective> REM = addUnit(
364            new ProductUnit<RadiationDoseEffective>(ERG.divide(Units.GRAM.multiply(100))));
365    // public static final Unit<RadiationDoseEffective> REM = addUnit(new
366    // AlternateUnit<RadiationDoseEffective>(
367    // RAD, RAD.getSymbol())); // TODO are symbols for RAD and REM same?
368    /////////////////////////////////////////////////
369    // INTERNATIONAL CUSTOMARY UNITS: UCUM 4.4 §34 //
370    /////////////////////////////////////////////////
371    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
372    public static final Unit<Length> INCH_INTERNATIONAL = addUnit(CENTI(METER).multiply(254).divide(100));
373    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
374    public static final Unit<Length> FOOT_INTERNATIONAL = addUnit(INCH_INTERNATIONAL.multiply(12));
375    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
376    public static final Unit<Length> YARD_INTERNATIONAL = addUnit(FOOT_INTERNATIONAL.multiply(3));
377    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
378    public static final Unit<Length> MILE_INTERNATIONAL = addUnit(FOOT_INTERNATIONAL.multiply(5280));
379    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
380    public static final Unit<Length> FATHOM_INTERNATIONAL = addUnit(FOOT_INTERNATIONAL.multiply(6));
381    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
382    public static final Unit<Length> NAUTICAL_MILE_INTERNATIONAL = addUnit(METER.multiply(1852));
383    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
384    public static final Unit<Speed> KNOT_INTERNATIONAL = addUnit(
385            new ProductUnit<Speed>(NAUTICAL_MILE_INTERNATIONAL.divide(HOUR)));
386    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
387    public static final Unit<Area> SQUARE_INCH_INTERNATIONAL = addUnit(
388            new ProductUnit<Area>(INCH_INTERNATIONAL.pow(2)));
389    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
390    public static final Unit<Area> SQUARE_FOOT_INTERNATIONAL = addUnit(
391            new ProductUnit<Area>(FOOT_INTERNATIONAL.pow(2)));
392    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
393    public static final Unit<Area> SQUARE_YARD_INTERNATIONAL = addUnit(
394            new ProductUnit<Area>(YARD_INTERNATIONAL.pow(2)));
395    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
396    public static final Unit<Volume> CUBIC_INCH_INTERNATIONAL = addUnit(
397            new ProductUnit<Volume>(INCH_INTERNATIONAL.pow(3)));
398    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
399    public static final Unit<Volume> CUBIC_FOOT_INTERNATIONAL = addUnit(
400            new ProductUnit<Volume>(FOOT_INTERNATIONAL.pow(3)));
401    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
402    public static final Unit<Volume> CUBIC_YARD_INTERNATIONAL = addUnit(
403            new ProductUnit<Volume>(YARD_INTERNATIONAL.pow(3)));
404    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
405    public static final Unit<Volume> BOARD_FOOT_INTERNATIONAL = addUnit(CUBIC_INCH_INTERNATIONAL.multiply(144));
406    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
407    public static final Unit<Volume> CORD_INTERNATIONAL = addUnit(CUBIC_FOOT_INTERNATIONAL.multiply(128));
408    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
409    public static final Unit<Length> MIL_INTERNATIONAL = addUnit(INCH_INTERNATIONAL.divide(1000));
410    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
411    public static final Unit<Area> CIRCULAR_MIL_INTERNATIONAL = addUnit(
412            new ProductUnit<Area>(MIL_INTERNATIONAL.pow(2).multiply(PI.divide(4))));
413    // public static final Unit<Area> CIRCULAR_MIL_INTERNATIONAL = addUnit(new
414    // ProductUnit<Area>(
415    // MIL_INTERNATIONAL.pow(2).multiply(PI).divide(4)));
416    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
417    public static final Unit<Length> HAND_INTERNATIONAL = addUnit(INCH_INTERNATIONAL.multiply(4));
418    //////////////////////////////////////////
419    // US SURVEY LENGTH UNITS: UCUM 4.4 §35 //
420    //////////////////////////////////////////
421    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
422    public static final Unit<Length> FOOT_US_SURVEY = addUnit(METER.multiply(1200).divide(3937));
423    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
424    public static final Unit<Length> YARD_US_SURVEY = addUnit(FOOT_US_SURVEY.multiply(3));
425    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
426    public static final Unit<Length> INCH_US_SURVEY = addUnit(FOOT_US_SURVEY.divide(12));
427    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
428    public static final Unit<Length> ROD_US_SURVEY = addUnit(FOOT_US_SURVEY.multiply(33).divide(2));
429    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
430    public static final Unit<Length> CHAIN_US_SURVEY = addUnit(ROD_US_SURVEY.multiply(4));
431    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
432    public static final Unit<Length> LINK_US_SURVEY = addUnit(CHAIN_US_SURVEY.divide(100));
433    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
434    public static final Unit<Length> RAMDEN_CHAIN_US_SURVEY = addUnit(FOOT_US_SURVEY.multiply(100));
435    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
436    public static final Unit<Length> RAMDEN_LINK_US_SURVEY = addUnit(CHAIN_US_SURVEY.divide(100));
437    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
438    public static final Unit<Length> FATHOM_US_SURVEY = addUnit(FOOT_US_SURVEY.multiply(6));
439    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
440    public static final Unit<Length> FURLONG_US_SURVEY = addUnit(ROD_US_SURVEY.multiply(40));
441    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
442    public static final Unit<Length> MILE_US_SURVEY = addUnit(FURLONG_US_SURVEY.multiply(8));
443    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
444    public static final Unit<Area> ACRE_US_SURVEY = addUnit(new ProductUnit<Area>(ROD_US_SURVEY.pow(2)).multiply(160));
445    // public static final Unit<Area> ACRE_US_SURVEY = addUnit(new
446    // ProductUnit<Area>(
447    // ROD_US_SURVEY.pow(2).multiply(160)));
448    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
449    public static final Unit<Area> SQUARE_ROD_US_SURVEY = addUnit(new ProductUnit<Area>(ROD_US_SURVEY.pow(2)));
450    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
451    public static final Unit<Area> SQUARE_MILE_US_SURVEY = addUnit(new ProductUnit<Area>(MILE_US_SURVEY.pow(2)));
452    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
453    public static final Unit<Area> SECTION_US_SURVEY = addUnit(new ProductUnit<Area>(MILE_US_SURVEY.pow(2)));
454    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
455    public static final Unit<Area> TOWNSHP_US_SURVEY = addUnit(SECTION_US_SURVEY.multiply(36));
456    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
457    public static final Unit<Length> MIL_US_SURVEY = addUnit(INCH_US_SURVEY.divide(1000));
458    /////////////////////////////////////////////////
459    // BRITISH IMPERIAL LENGTH UNITS: UCUM 4.4 §36 //
460    /////////////////////////////////////////////////
461    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
462    public static final Unit<Length> INCH_BRITISH = addUnit(CENTI(METER).multiply(2539998).divide(1000000));
463    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
464    public static final Unit<Length> FOOT_BRITISH = addUnit(INCH_BRITISH.multiply(12));
465    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
466    public static final Unit<Length> ROD_BRITISH = addUnit(FOOT_BRITISH.multiply(33).divide(2));
467    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
468    public static final Unit<Length> CHAIN_BRITISH = addUnit(ROD_BRITISH.multiply(4));
469    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
470    public static final Unit<Length> LINK_BRITISH = addUnit(CHAIN_BRITISH.divide(100));
471    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
472    public static final Unit<Length> FATHOM_BRITISH = addUnit(FOOT_BRITISH.multiply(6));
473    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
474    public static final Unit<Length> PACE_BRITISH = addUnit(FOOT_BRITISH.multiply(5).divide(2));
475    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
476    public static final Unit<Length> YARD_BRITISH = addUnit(FOOT_BRITISH.multiply(3));
477    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
478    public static final Unit<Length> MILE_BRITISH = addUnit(FOOT_BRITISH.multiply(5280));
479    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
480    public static final Unit<Length> NAUTICAL_MILE_BRITISH = addUnit(FOOT_BRITISH.multiply(6080));
481    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
482    public static final Unit<Speed> KNOT_BRITISH = addUnit(new ProductUnit<Speed>(NAUTICAL_MILE_BRITISH.divide(HOUR)));
483    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
484    public static final Unit<Area> ACRE_BRITISH = addUnit(new ProductUnit<Area>(YARD_BRITISH.pow(2)).multiply(4840));
485    // public static final Unit<Area> ACRE_BRITISH = addUnit(new
486    // ProductUnit<Area>(
487    // YARD_BRITISH.pow(2).multiply(4840)));
488    ///////////////////////////////////
489    // US VOLUME UNITS: UCUM 4.4 §37 //
490    ///////////////////////////////////
491    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
492    public static final Unit<Volume> GALLON_US = addUnit(CUBIC_INCH_INTERNATIONAL.multiply(231));
493    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
494    public static final Unit<Volume> BARREL_US = addUnit(GALLON_US.multiply(42));
495    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
496    public static final Unit<Volume> QUART_US = addUnit(GALLON_US.divide(4));
497    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
498    public static final Unit<Volume> PINT_US = addUnit(QUART_US.divide(2));
499    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
500    public static final Unit<Volume> GILL_US = addUnit(PINT_US.divide(4));
501    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
502    public static final Unit<Volume> FLUID_OUNCE_US = addUnit(GILL_US.divide(4));
503    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
504    public static final Unit<Volume> FLUID_DRAM_US = addUnit(FLUID_OUNCE_US.divide(8));
505    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
506    public static final Unit<Volume> MINIM_US = addUnit(FLUID_DRAM_US.divide(60));
507    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
508    public static final Unit<Volume> CORD_US = addUnit(CUBIC_FOOT_INTERNATIONAL.multiply(128));
509    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
510    public static final Unit<Volume> BUSHEL_US = addUnit(CUBIC_INCH_INTERNATIONAL.multiply(215042).divide(100));
511    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
512    public static final Unit<Volume> GALLON_WINCHESTER = addUnit(BUSHEL_US.divide(8));
513    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
514    public static final Unit<Volume> PECK_US = addUnit(BUSHEL_US.divide(4));
515    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
516    public static final Unit<Volume> DRY_QUART_US = addUnit(PECK_US.divide(8));
517    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
518    public static final Unit<Volume> DRY_PINT_US = addUnit(DRY_QUART_US.divide(2));
519    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
520    public static final Unit<Volume> TABLESPOON_US = addUnit(FLUID_OUNCE_US.divide(2));
521    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
522    public static final Unit<Volume> TEASPOON_US = addUnit(TABLESPOON_US.divide(3));
523    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
524    public static final Unit<Volume> CUP_US = addUnit(TABLESPOON_US.multiply(16));
525    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
526    public static final Unit<Volume> METRIC_FLUID_OUNCE_US = addUnit(MILLI(LITER).multiply(30));
527    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
528    public static final Unit<Volume> METRIC_CUP_US = addUnit(MILLI(LITER).multiply(240));
529    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
530    public static final Unit<Volume> METRIC_TEASPOON_CUP_US = addUnit(MILLI(LITER).multiply(5));
531    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
532    public static final Unit<Volume> METRIC_TABLESPOON_CUP_US = addUnit(MILLI(LITER).multiply(15));
533    /////////////////////////////////////////////////
534    // BRITISH IMPERIAL VOLUME UNITS: UCUM 4.4 §38 //
535    /////////////////////////////////////////////////
536    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
537    public static final Unit<Volume> GALLON_BRITISH = addUnit(LITER.multiply(454609).divide(100000));
538    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
539    public static final Unit<Volume> PECK_BRITISH = addUnit(GALLON_BRITISH.multiply(2));
540    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
541    public static final Unit<Volume> BUSHEL_BRITISH = addUnit(PECK_BRITISH.multiply(4));
542    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
543    public static final Unit<Volume> QUART_BRITISH = addUnit(GALLON_BRITISH.divide(4));
544    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
545    public static final Unit<Volume> PINT_BRITISH = addUnit(QUART_BRITISH.divide(2));
546    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
547    public static final Unit<Volume> GILL_BRITISH = addUnit(PINT_BRITISH.divide(4));
548    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
549    public static final Unit<Volume> FLUID_OUNCE_BRITISH = addUnit(GILL_BRITISH.divide(5));
550    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
551    public static final Unit<Volume> FLUID_DRAM_BRITISH = addUnit(FLUID_OUNCE_BRITISH.divide(8));
552    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
553    public static final Unit<Volume> MINIM_BRITISH = addUnit(FLUID_DRAM_BRITISH.divide(60));
554    ////////////////////////////////////////////
555    // AVOIRDUPOIS WIEGHT UNITS: UCUM 4.4 §39 //
556    ////////////////////////////////////////////
557    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
558    public static final Unit<Mass> GRAIN = addUnit(MILLI(GRAM).multiply(6479891).divide(100000));
559    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
560    public static final Unit<Mass> POUND = addUnit(GRAIN.multiply(7000));
561    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
562    public static final Unit<Mass> OUNCE = addUnit(POUND.divide(16));
563    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
564    public static final Unit<Mass> DRAM = addUnit(OUNCE.divide(16));
565    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
566    public static final Unit<Mass> SHORT_HUNDREDWEIGHT = addUnit(POUND.multiply(100));
567    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
568    public static final Unit<Mass> LONG_HUNDREDWEIGHT = addUnit(POUND.multiply(112));
569    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
570    public static final Unit<Mass> SHORT_TON = addUnit(SHORT_HUNDREDWEIGHT.multiply(20));
571    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
572    public static final Unit<Mass> LONG_TON = addUnit(LONG_HUNDREDWEIGHT.multiply(20));
573    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
574    public static final Unit<Mass> STONE = addUnit(POUND.multiply(14));
575    // CONTINUED FROM SECTION §32
576    // contains a forward reference to POUND, so we had to move it here, below
577    // section §39
578    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
579    // public static final Unit<Force> POUND_FORCE = addUnit(new
580    // ProductUnit<Force>(
581    // POUND.multiply(ACCELLERATION_OF_FREEFALL)));
582    public static final Unit<Force> POUND_FORCE = addUnit(
583            POUND.multiply(ACCELLERATION_OF_FREEFALL).asType(Force.class));
584
585    // public static final Unit<InformationRate> POUND_FORCE2 =
586    // addUnit(POUND.multiply(ACCELLERATION_OF_FREEFALL).asType(InformationRate.class));
587
588    /////////////////////////////////////
589    // TROY WEIGHT UNITS: UCUM 4.4 §40 //
590    /////////////////////////////////////
591    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
592    public static final Unit<Mass> PENNYWEIGHT_TROY = addUnit(GRAIN.multiply(24));
593    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
594    public static final Unit<Mass> OUNCE_TROY = addUnit(PENNYWEIGHT_TROY.multiply(20));
595    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
596    public static final Unit<Mass> POUND_TROY = addUnit(OUNCE_TROY.multiply(12));
597    /////////////////////////////////////////////
598    // APOTECARIES' WEIGHT UNITS: UCUM 4.4 §41 //
599    /////////////////////////////////////////////
600    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
601    public static final Unit<Mass> SCRUPLE_APOTHECARY = addUnit(GRAIN.multiply(20));
602    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
603    public static final Unit<Mass> DRAM_APOTHECARY = addUnit(SCRUPLE_APOTHECARY.multiply(3));
604    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
605    public static final Unit<Mass> OUNCE_APOTHECARY = addUnit(DRAM_APOTHECARY.multiply(8));
606    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
607    public static final Unit<Mass> POUND_APOTHECARY = addUnit(OUNCE_APOTHECARY.multiply(12));
608    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
609    public static final Unit<Mass> METRIC_OUNCE = addUnit(GRAM.multiply(28));
610
611    /////////////////////////////////////////////
612    // TYPESETTER'S LENGTH UNITS: UCUM 4.4 §42 //
613    /////////////////////////////////////////////
614    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
615    public static final Unit<Length> LINE = addUnit(INCH_INTERNATIONAL.divide(12));
616    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
617    public static final Unit<Length> POINT = addUnit(LINE.divide(6));
618    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
619    public static final Unit<Length> PICA = addUnit(POINT.multiply(12));
620    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
621    public static final Unit<Length> POINT_PRINTER = addUnit(INCH_INTERNATIONAL.multiply(13837).divide(1000000));
622    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
623    public static final Unit<Length> PICA_PRINTER = addUnit(POINT_PRINTER.multiply(12));
624    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
625    public static final Unit<Length> PIED = addUnit(CENTI(METER).multiply(3248).divide(100));
626    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
627    public static final Unit<Length> POUCE = addUnit(PIED.divide(12));
628    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
629    public static final Unit<Length> LIGNE = addUnit(POUCE.divide(12));
630    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
631    public static final Unit<Length> DIDOT = addUnit(LIGNE.divide(6));
632    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
633    public static final Unit<Length> CICERO = addUnit(DIDOT.multiply(12));
634    //////////////////////////////////////
635    // OTHER LEGACY UNITS: UCUM 4.5 §43 //
636    //////////////////////////////////////
637    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
638    public static final Unit<Temperature> FAHRENHEIT = addUnit(KELVIN.multiply(9).divide(5).shift(459.67));
639    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
640    public static final Unit<Temperature> RANKINE = addUnit(KELVIN.divide(9).multiply(5));
641    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
642    public static final Unit<Temperature> REAUMUR = addUnit(KELVIN.multiply(4).divide(5).shift(218.52));
643    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
644    public static final Unit<Energy> CALORIE_AT_15C = addUnit(JOULE.multiply(41858).divide(10000));
645    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
646    public static final Unit<Energy> CALORIE_AT_20C = addUnit(JOULE.multiply(41819).divide(10000));
647    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
648    public static final Unit<Energy> CALORIE_MEAN = addUnit(JOULE.multiply(419002).divide(100000));
649    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
650    public static final Unit<Energy> CALORIE_INTERNATIONAL_TABLE = addUnit(JOULE.multiply(41868).divide(10000));
651    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
652    public static final Unit<Energy> CALORIE_THERMOCHEMICAL = addUnit(JOULE.multiply(4184).divide(1000));
653    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
654    public static final Unit<Energy> CALORIE = addUnit(CALORIE_THERMOCHEMICAL);
655    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
656    public static final Unit<Energy> CALORIE_FOOD = addUnit(KILO(CALORIE_THERMOCHEMICAL));
657
658    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
659    public static final Unit<Energy> BTU_AT_39F = addUnit(KILO(JOULE).multiply(105967).divide(100000));
660    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
661    public static final Unit<Energy> BTU_AT_59F = addUnit(KILO(JOULE).multiply(105480).divide(100000));
662    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
663    public static final Unit<Energy> BTU_AT_60F = addUnit(KILO(JOULE).multiply(105468).divide(100000));
664    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
665    public static final Unit<Energy> BTU_MEAN = addUnit(KILO(JOULE).multiply(105587).divide(100000));
666    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
667    public static final Unit<Energy> BTU_INTERNATIONAL_TABLE = addUnit(
668            KILO(JOULE).multiply(105505585262L).divide(100000000000L));
669    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
670    public static final Unit<Energy> BTU_THERMOCHEMICAL = addUnit(KILO(JOULE).multiply(105435).divide(100000));
671    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
672    public static final Unit<Energy> BTU = addUnit(BTU_THERMOCHEMICAL);
673    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
674    public static final Unit<Power> HORSEPOWER = addUnit(
675            new ProductUnit<Power>(FOOT_INTERNATIONAL.multiply(POUND_FORCE).divide(SECOND)));
676
677    ////////////////////////////////////////////
678    // CLINICAL MEDICINE UNITS: UCUM 4.5 §44 //
679    ///////////////////////////////////////////
680    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
681    public static final Unit<Pressure> METER_OF_WATER_COLUMN = addUnit(KILO(PASCAL).multiply(980665).divide(100000));
682    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
683    public static final Unit<Pressure> METER_OF_MERCURY_COLUMN = addUnit(KILO(PASCAL).multiply(1333220).divide(10000));
684    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
685    public static final Unit<Pressure> INCH_OF_WATER_COLUMN = addUnit(
686            new ProductUnit<Pressure>(METER_OF_WATER_COLUMN.multiply(INCH_INTERNATIONAL).divide(METER)));
687    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
688    public static final Unit<Pressure> INCH_OF_MERCURY_COLUMN = addUnit(
689            new ProductUnit<Pressure>(METER_OF_MERCURY_COLUMN.multiply(INCH_INTERNATIONAL).divide(METER)));
690
691    // public static final Unit PERIPHERAL_VASCULAR_RESISTANCE =
692    // addUnit(MILLI(METER_OF_MERCURY_COLUMN).multiply(SECOND).divide(MILLI(LITER)));
693    // public static final Unit WOOD =
694    // addUnit(MILLI(METER_OF_MERCURY_COLUMN).multiply(MINUTE).divide(LITER));
695    // public static final Unit DIOPTER = addUnit(ONE.divide(METER));
696    // public static final Unit PRISM_DIOPTER =
697    // addUnit(ONE.multiply(100).multiply(Math.tan(1)));
698    // public static final Unit PERCENT_OF_SLOPE =
699    // addUnit(ONE.multiply(100).multiply(Math.tan(1)));
700    // public static final Unit MESH = addUnit(ONE.divide(INCH_INTERNATIONAL));
701    // public static final Unit CHARRIERE = addUnit(MILLI(METER).divide(3));
702
703    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
704    public static final Unit<Volume> DROP = addUnit(MILLI(LITER).divide(20));
705
706    // public static final Unit HOUNSFIELD = addUnit(ONE);
707    // public static final Unit METABOLIC_EQUIVALENT =
708    // addUnit(MILLI(LITER).divide(MINUTE).divide(KILO(GRAM)));
709
710    // public static final Unit HOMEOPATHIC_POTENCY_OF_DECIMAL =
711    // addUnit(ONE.multiply(-1).multiply(Math.log10(1)));
712    // public static final Unit HOMEOPATHIC_POTENCY_OF_CENTESIMAL =
713    // addUnit(ONE.multiply(-1).multiply(Math.log(1)).divide(Math.log(100)));
714    // public static final Unit HOMEOPATHIC_POTENCY_OF_MILLESIMAL =
715    // addUnit(ONE.multiply(-1).multiply(Math.log(1)).divide(Math.log(1000)));
716    // public static final Unit HOMEOPATHIC_POTENCY_OF_QUINTALLESIMAL =
717    // addUnit(ONE.multiply(-1).multiply(Math.log(1)).divide(Math.log(50000)));
718
719    // public static final Unit HOMEOPATHIC_POTENCY_OF_DECIMAL_HAHNEMANNIAN =
720    // UNDEFINED;
721    // public static final Unit HOMEOPATHIC_POTENCY_OF_CENTESIMAL_HAHNEMANNIAN =
722    // UNDEFINED;
723    // public static final Unit HOMEOPATHIC_POTENCY_OF_MILLESIMAL_HAHNEMANNIAN =
724    // UNDEFINED;
725    // public static final Unit
726    // HOMEOPATHIC_POTENCY_OF_QUINTAMILLESIMAL_HAHNEMANNIAN = UNDEFINED;
727    // public static final Unit HOMEOPATHIC_POTENCY_OF_DECIMAL_KORSAKOVIAN =
728    // UNDEFINED;
729    // public static final Unit HOMEOPATHIC_POTENCY_OF_CENTESIMAL_KORSAKOVIAN =
730    // UNDEFINED;
731    // public static final Unit HOMEOPATHIC_POTENCY_OF_MILLESIMAL_KORSAKOVIAN =
732    // UNDEFINED;
733    // public static final Unit
734    // HOMEOPATHIC_POTENCY_OF_QUINTAMILLESIMAL_KORSAKOVIAN = UNDEFINED;
735
736    //////////////////////////////////////////////////
737    // CHEMICAL AND BIOCHEMICAL UNITS: UCUM 4.5 §45 //
738    //////////////////////////////////////////////////
739    // public static final Unit EQUIVALENTS = addUnit(MOLE);
740    // public static final Unit OSMOLE = addUnit(MOLE);
741
742    public static final Unit<Acidity> PH = addUnit(MOLE.divide(LITER).transform(new LogConverter(10)).multiply(-1).asType(Acidity.class));
743
744    // @SuppressWarnings("unchecked")
745    public static final Unit<Concentration<Mass>> GRAM_PERCENT = addUnit(GRAM.divide(DECI(LITER)).asType(Concentration.class));
746
747    // public static final Unit SVEDBERG = addUnit(SECOND.multiply(1E-13));
748
749    public static final Unit<Dimensionless> HIGH_POWER_FIELD = addUnit(ONE);
750    public static final Unit<Dimensionless> LOW_POWER_FIELD = addUnit(ONE.multiply(100));
751
752    // public static final Unit KATAL = addUnit(MOLE.divide(SECOND));
753    // public static final Unit UNIT = addUnit(MICRO(MOLE).divide(MINUTE));
754
755    // public static final Unit INTERNATIONAL_UNIT = UNDEFINED;
756    // public static final Unit ARBITRARY_UNIT = UNDEFINED;
757    // public static final Unit US_PHARMACOPEIA = UNDEFINED;
758    // public static final Unit GPL = UNDEFINED;
759    // public static final Unit MPL = UNDEFINED;
760    // public static final Unit APL = UNDEFINED;
761    // public static final Unit BETHESDA = UNDEFINED;
762    // public static final Unit ANTI_FACTOR_XA = UNDEFINED;
763    // public static final Unit TODD = UNDEFINED;
764    // public static final Unit DYE = UNDEFINED;
765    // public static final Unit SOMOGYI = UNDEFINED;
766    // public static final Unit BODANSKY = UNDEFINED;
767    // public static final Unit KING_ARMSTRONG = UNDEFINED;
768    // public static final Unit KUNKEL = UNDEFINED;
769    // public static final Unit MAC_LAGAN = UNDEFINED;
770    // public static final Unit TUBERCULIN = UNDEFINED;
771    // public static final Unit CELL_CULTURE_INFECTIOUS_50_PERCENT_DOSE =
772    // UNDEFINED;
773    // public static final Unit TISSUE_CULTURE_INFECTIOUS_50_PERCENT_DOSE =
774    // UNDEFINED;
775    // public static final Unit EMBRYO_CULTURE_INFECTIOUS_50_PERCENT_DOSE =
776    // UNDEFINED;
777    // public static final Unit PLAQUE_FORMING = UNDEFINED;
778    // public static final Unit FOCUS_FORMING = UNDEFINED;
779    // public static final Unit COLONY_FORMING = UNDEFINED;
780    // public static final Unit INDEX_OF_REACTIVITY = UNDEFINED;
781    // public static final Unit BIOEQUIVALENT_ALLERGEN = UNDEFINED;
782    // public static final Unit ALLERGEN = UNDEFINED;
783    // public static final Unit ALLERGEN_FOR_AMBROSIA_ARTEMISIIFOLIA =
784    // UNDEFINED;
785    // public static final Unit PROTEIN_NITROGEN = UNDEFINED;
786    // public static final Unit LIMIT_OF_FLOCCULATION = UNDEFINED;
787    // public static final Unit D_ANTIGEN = UNDEFINED;
788    // public static final Unit FIBRINOGEN_EQUIVALENT = UNDEFINED;
789    // public static final Unit ELISA = UNDEFINED;
790    // public static final Unit EHRLICH = UNDEFINED;
791    // public static final Unit CHEMICAL = UNDEFINED;
792
793    /////////////////////////////////
794    // LEVELS UNITS: UCUM 4.5 §46 //
795    ////////////////////////////////
796    @SuppressWarnings("unchecked")
797    public static final Unit<Level<Dimensionless>> NEPER = addUnit(
798            ONE.transform(new LogConverter(Math.E)).asType(Level.class));
799    /**
800     * A logarithmic unit used to describe a power {@link Level} ratio (standard
801     * name <code>dB</code>).
802     */
803    // public static final Unit<Level<Power>> DECIBEL = addUnit(NEPER
804    // .transform(new LogConverter(10).inverse().concatenate(
805    // RationalConverter.of(1d, 10d))));
806
807    @SuppressWarnings("unchecked")
808    public static final Unit<Level<Dimensionless>> BEL = addUnit(
809            ONE.transform(new LogConverter(10)).asType(Level.class));
810
811    @SuppressWarnings("unchecked")
812    public static final Unit<Level<Pressure>> BEL_SOUND = addUnit(
813            PASCAL.divide(1E5).multiply(2).transform(new LogConverter(10)).multiply(2).asType(Level.class));
814
815    @SuppressWarnings("unchecked")
816    public static final Unit<Level<ElectricPotential>> BEL_VOLT = addUnit(
817            VOLT.transform(new LogConverter(10)).multiply(2).asType(Level.class));
818
819    @SuppressWarnings("unchecked")
820    public static final Unit<Level<ElectricPotential>> BEL_MILLIVOLT = addUnit(
821            MILLI(VOLT).transform(new LogConverter(10)).multiply(2).asType(Level.class));
822
823    @SuppressWarnings("unchecked")
824    public static final Unit<Level<ElectricPotential>> BEL_MICROVOLT = addUnit(
825            MICRO(VOLT).transform(new LogConverter(10)).multiply(2).asType(Level.class));
826
827    @SuppressWarnings("unchecked")
828    public static final Unit<Level<ElectricPotential>> BEL_10_NANOVOLT = addUnit(
829            NANO(VOLT).multiply(10).transform(new LogConverter(10)).multiply(2).asType(Level.class));
830
831    @SuppressWarnings("unchecked")
832    public static final Unit<Level<ElectricPotential>> BEL_WATT = addUnit(
833            WATT.transform(new LogConverter(10)).asType(Level.class));
834
835    @SuppressWarnings("unchecked")
836    public static final Unit<Level<ElectricPotential>> BEL_KILOWATT = addUnit(
837            KILO(WATT).transform(new LogConverter(10)).asType(Level.class));
838
839    ///////////////////////////////////////
840    // MISCELLANEOUS UNITS: UCUM 4.5 §47 //
841    ///////////////////////////////////////
842    /** temporary helper for MHO */
843    private static final Unit<? extends Quantity<?>> TMP_MHO = SIEMENS.alternate("mho");
844
845    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
846    public static final Unit<Volume> STERE = addUnit(new ProductUnit<Volume>(METER.pow(3)));
847    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
848    public static final Unit<Length> ANGSTROM = addUnit(NANO(METER).divide(10));
849    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
850    public static final Unit<Area> BARN = addUnit(new ProductUnit<Area>(FEMTO(METER).pow(2)).multiply(100));
851    // public static final Unit<Area> BARN = addUnit(new
852    // ProductUnit<Area>(FEMTO(
853    // METER).pow(2).multiply(100)));
854    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
855    public static final Unit<Pressure> ATMOSPHERE_TECHNICAL = addUnit(
856            new ProductUnit<Pressure>(KILO(GRAM_FORCE).divide(CENTI(METER).pow(2))));
857    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
858    public static final Unit<ElectricConductance> MHO = addUnit(
859            new AlternateUnit<ElectricConductance>(TMP_MHO, TMP_MHO.getSymbol()));
860    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
861    public static final Unit<Pressure> POUND_PER_SQUARE_INCH = addUnit(
862            new ProductUnit<Pressure>(POUND_FORCE.divide(INCH_INTERNATIONAL.pow(2))));
863    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
864    public static final Unit<Angle> CIRCLE = addUnit(new ProductUnit<Angle>(PI.multiply(RADIAN.multiply(2))));
865    // public static final Unit<Angle> CIRCLE = addUnit(new
866    // ProductUnit<Angle>(PI
867    // .multiply(RADIAN).multiply(2)));
868    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
869    public static final Unit<SolidAngle> SPHERE = addUnit(
870            new ProductUnit<SolidAngle>(PI.multiply(STERADIAN.multiply(4))));
871    // public static final Unit<SolidAngle> SPHERE = addUnit(new
872    // ProductUnit<SolidAngle>(
873    // PI.multiply(STERADIAN).multiply(4)));
874    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
875    public static final Unit<Mass> CARAT_METRIC = addUnit(GRAM.divide(5));
876    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
877    public static final Unit<Dimensionless> CARAT_GOLD = addUnit(ONE.divide(24));
878    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
879    public static final Unit<Length> SMOOT = addUnit(INCH_INTERNATIONAL.multiply(67));
880
881    ////////////////////////////////////////////////
882    // INFORMATION TECHNOLOGY UNITS: UCUM 4.6 §48 //
883    ////////////////////////////////////////////////
884    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
885    public static final Unit<Information> BIT = addUnit(NonSI.BIT);
886    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
887    public static final Unit<Information> BYTE = addUnit(NonSI.BIT.multiply(8));
888    /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
889    public static final Unit<InformationRate> BAUD = addUnit(NonSI.BITS_PER_SECOND);
890
891    /////////////////////
892    // Collection View //
893    /////////////////////
894
895    @Override
896    public String getName() {
897        return "Unified Code for Units of Measure";
898    }
899
900    private static <U extends Unit<Q>, Q extends Quantity<Q>> U addUnit(U unit) {
901        INSTANCE.units.add(unit);
902        return unit;
903    }
904
905    /**
906     * Adds a new unit and maps it to the specified quantity type.
907     *
908     * @param unit
909     *            the unit being added.
910     * @param type
911     *            the quantity type.
912     * @return <code>unit</code>.
913     */
914    private static <U extends AbstractUnit<?>> U addUnit(U unit, Class<? extends Quantity<?>> type) {
915        INSTANCE.units.add(unit);
916        INSTANCE.quantityToUnit.put(type, unit);
917        return unit;
918    }
919
920    ////////////////////////////////////////////////////////////////////////////
921    // Label adjustments for UCUM system
922    static {
923        SimpleUnitFormat.getInstance().label(ATOMIC_MASS_UNIT, "AMU");
924        SimpleUnitFormat.getInstance().label(LITER, "l");
925        SimpleUnitFormat.getInstance().label(OUNCE, "oz");
926        SimpleUnitFormat.getInstance().label(POUND, "lb");
927        SimpleUnitFormat.getInstance().label(PLANCK, "h");
928        // TODO maybe we can find a better solution, but it would require to
929        // "harvest" the entire UCUMFormat ResourceBundle and label every
930        // matching UCUM unit in a loop.
931    }
932}