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