001/* 002 * Units of Measurement Systems 003 * Copyright (c) 2005-2018, 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-363, 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 tec.uom.se.unit.MetricPrefix.*; 033import static tec.uom.se.AbstractUnit.ONE; 034import si.uom.quantity.*; 035import systems.uom.quantity.Acidity; 036import systems.uom.quantity.Concentration; 037import systems.uom.quantity.Drag; 038import systems.uom.quantity.Information; 039import systems.uom.quantity.InformationRate; 040import systems.uom.quantity.Level; 041import si.uom.SI; 042import tec.uom.se.*; 043import tec.uom.se.format.SimpleUnitFormat; 044import tec.uom.se.function.LogConverter; 045import tec.uom.se.function.MultiplyConverter; 046import tec.uom.se.function.PiMultiplierConverter; 047import tec.uom.se.unit.AlternateUnit; 048import tec.uom.se.unit.ProductUnit; 049import tec.uom.se.unit.TransformedUnit; 050import tec.uom.se.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 are 066 * likely to be incomplete. 067 * </p> 068 * 069 * @author <a href="mailto:eric-r@northwestern.edu">Eric Russell</a> 070 * @author <a href="mailto:units@catmedia.us">Werner Keil</a> 071 * @see <a href="http://www.unitsofmeasure.org">UCUM</a> 072 * @version 0.9, $Date: 2018-06-10 $ 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(new PiMultiplierConverter())); 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); 175 // public static final Unit<MagnetomotiveForce> AMPERE_TURN = 176 // addUnit(Units.AMPERE_TURN); 177 /** 178 * We deviate slightly from the standard here, to maintain compatibility 179 * with the existing SI units. In UCUM, the volt is defined as 180 * <code>JOULE.divide(COULOMB)</code>. 181 */ 182 public static final Unit<ElectricPotential> VOLT = addUnit(Units.VOLT); 183 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 184 public static final Unit<ElectricCapacitance> FARAD = addUnit(Units.FARAD); 185 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 186 public static final Unit<ElectricResistance> OHM = addUnit(Units.OHM); 187 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 188 public static final Unit<ElectricConductance> SIEMENS = addUnit(Units.SIEMENS); 189 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 190 public static final Unit<MagneticFlux> WEBER = addUnit(Units.WEBER); 191 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 192 public static final Unit<Temperature> CELSIUS = addUnit(Units.CELSIUS); 193 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 194 public static final Unit<MagneticFluxDensity> TESLA = addUnit(Units.TESLA); 195 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 196 public static final Unit<ElectricInductance> HENRY = addUnit(Units.HENRY); 197 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 198 public static final Unit<LuminousFlux> LUMEN = addUnit(Units.LUMEN); 199 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 200 public static final Unit<Illuminance> LUX = addUnit(Units.LUX); 201 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 202 public static final Unit<Radioactivity> BECQUEREL = addUnit(Units.BECQUEREL); 203 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 204 public static final Unit<RadiationDoseAbsorbed> GRAY = addUnit(Units.GRAY); 205 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 206 public static final Unit<RadiationDoseEffective> SIEVERT = addUnit(Units.SIEVERT); 207 208 /////////////////////////////////////////////////////////////////////// 209 // OTHER UNITS FROM ISO 1000, ISO 2955, AND ANSI X3.50: UCUM 4.3 §31 // 210 /////////////////////////////////////////////////////////////////////// 211 // The order of GON and DEGREE has been inverted because GON is defined in 212 // terms of DEGREE 213 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 214 public static final Unit<Angle> DEGREE = addUnit(new ProductUnit<Angle>(PI.multiply(RADIAN.divide(180)))); 215 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 216 public static final Unit<Angle> GRADE = addUnit(DEGREE.multiply(0.9)); 217 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 218 public static final Unit<Angle> GON = GRADE; 219 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 220 public static final Unit<Angle> MINUTE_ANGLE = addUnit(DEGREE.divide(60)); 221 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 222 public static final Unit<Angle> SECOND_ANGLE = addUnit(MINUTE_ANGLE.divide(60)); 223 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 224 public static final Unit<Volume> LITER = addUnit(Units.LITRE, "liter", "L", true); 225 /** 226 * As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. Liter has 227 * <b>two</b> definitions. 228 * 229 * @see <a href="http://unitsofmeasure.org/ucum.html#iso1000">UCUM Table 230 * 5</a> 231 */ 232 public static final Unit<Volume> LITER_DM3 = addUnit(DECI(Units.METRE).pow(3).asType(Volume.class), "liter", "l", true); 233 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 234 public static final Unit<Area> ARE = addUnit(Units.SQUARE_METRE.multiply(100)); 235 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 236 public static final Unit<Time> MINUTE = addUnit(Units.MINUTE); 237 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 238 public static final Unit<Time> HOUR = addUnit(Units.HOUR); 239 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 240 public static final Unit<Time> DAY = addUnit(Units.DAY); 241 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 242 public static final Unit<Time> YEAR_TROPICAL = addUnit(Units.DAY.multiply(365.24219)); 243 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 244 public static final Unit<Time> YEAR_JULIAN = addUnit(Units.DAY.multiply(365.25)); 245 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 246 public static final Unit<Time> YEAR_GREGORIAN = addUnit(Units.DAY.multiply(365.2425)); 247 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 248 public static final Unit<Time> YEAR = addUnit(Units.DAY.multiply(365.25)); 249 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 250 public static final Unit<Time> WEEK = addUnit(Units.DAY.multiply(7)); 251 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 252 public static final Unit<Time> MONTH_SYNODAL = addUnit(Units.DAY.multiply(29.53059)); 253 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 254 public static final Unit<Time> MONTH_JULIAN = addUnit(YEAR_JULIAN.divide(12)); 255 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 256 public static final Unit<Time> MONTH_GREGORIAN = addUnit(YEAR_GREGORIAN.divide(12)); 257 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 258 public static final Unit<Time> MONTH = addUnit(YEAR_JULIAN.divide(12)); 259 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 260 public static final Unit<Mass> TONNE = addUnit(Units.KILOGRAM.multiply(1000)); 261 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 262 public static final Unit<Pressure> BAR = addUnit(Units.PASCAL.multiply(100000)); 263 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 264 public static final Unit<Mass> ATOMIC_MASS_UNIT = addUnit(SI.UNIFIED_ATOMIC_MASS); 265 // public static final Unit<Mass> ATOMIC_MASS_UNIT = addUnit( 266 // new AlternateUnit<Mass>(Units.UNIFIED_ATOMIC_MASS, 267 // Units.UNIFIED_ATOMIC_MASS.getSymbol()), Mass.class); 268 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 269 public static final Unit<Energy> ELECTRON_VOLT = addUnit(SI.ELECTRON_VOLT); 270 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 271 public static final Unit<Length> ASTRONOMIC_UNIT = addUnit(SI.ASTRONOMICAL_UNIT); 272 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 273 public static final Unit<Length> PARSEC = addUnit(Units.METRE.multiply(3.085678E16)); 274 275 ///////////////////////////////// 276 // NATURAL UNITS: UCUM 4.3 §32 // 277 ///////////////////////////////// 278 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 279 public static final Unit<Speed> VELOCITY_OF_LIGHT = addUnit(Units.METRE_PER_SECOND.multiply(299792458)); 280 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 281 public static final Unit<Action> PLANCK = addUnit(SI.JOULE_SECOND.multiply(6.6260755E-34)); 282 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 283 public static final Unit<?> BOLTZMAN = addUnit(JOULE.divide(KELVIN).multiply(1.380658E-23)); 284 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 285 public static final Unit<ElectricPermittivity> PERMITTIVITY_OF_VACUUM = addUnit( 286 SI.FARAD_PER_METRE.multiply(8.854187817E-12)); 287 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 288 public static final Unit<MagneticPermeability> PERMEABILITY_OF_VACUUM = addUnit( 289 new ProductUnit<MagneticPermeability>(SI.NEWTON_PER_SQUARE_AMPERE.multiply(PI.multiply(4).divide(1E7))), 290 MagneticPermeability.class); 291 // public static final Unit<MagneticPermeability> PERMEABILITY_OF_VACUUM = 292 // addUnit( 293 // new ProductUnit<MagneticPermeability>(Units.NEWTONS_PER_SQUARE_AMPERE 294 // .multiply(PI).multiply(4).divide(1E7)), 295 // MagneticPermeability.class); 296 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 297 public static final Unit<ElectricCharge> ELEMENTARY_CHARGE = addUnit( 298 Units.COULOMB.transform(((AbstractUnit<Energy>) SI.ELECTRON_VOLT).getSystemConverter())); 299 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 300 public static final Unit<Mass> ELECTRON_MASS = addUnit(GRAM.multiply(9.1093897E-28)); 301 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 302 public static final Unit<Mass> PROTON_MASS = addUnit(GRAM.multiply(1.6726231E-24)); 303 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 304 public static final Unit<?> NEWTON_CONSTANT_OF_GRAVITY = addUnit( 305 METER.pow(3).multiply(Units.KILOGRAM.pow(-1)).multiply(SECOND.pow(-2)).multiply(6.67259E-11)); 306 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 307 public static final Unit<Acceleration> ACCELERATION_OF_FREEFALL = addUnit( 308 Units.METRE_PER_SQUARE_SECOND.multiply(9.80665)); 309 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 310 public static final Unit<Pressure> ATMOSPHERE = addUnit(Units.PASCAL.multiply(101325)); 311 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 312 public static final Unit<Length> LIGHT_YEAR = addUnit( 313 new ProductUnit<Length>(VELOCITY_OF_LIGHT.multiply(YEAR_JULIAN))); 314 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 315 public static final Unit<Force> GRAM_FORCE = addUnit( 316 new ProductUnit<Force>(GRAM.multiply(ACCELERATION_OF_FREEFALL))); 317 // POUND_FORCE contains a forward reference to avoirdupois pound weight, so 318 // it has been moved after section §39 below 319 320 ///////////////////////////// 321 // CGS UNITS: UCUM 4.3 §33 // 322 ///////////////////////////// 323 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 324 public static final Unit<WaveNumber> KAYSER = addUnit(SI.RECIPROCAL_METRE.divide(100)); 325 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 326 public static final Unit<Acceleration> GAL = addUnit( 327 new ProductUnit<Acceleration>(CENTI(METER).divide(SECOND.pow(2)))); 328 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 329 public static final Unit<Force> DYNE = addUnit( 330 new ProductUnit<Force>(Units.GRAM.multiply(CENTI(Units.METRE).divide(Units.SECOND.pow(2))))); 331 // public static final Unit<Force> DYNE = addUnit(new ProductUnit<Force>( 332 // Units.GRAM.multiply(new 333 // ProductUnit(CENTI(Units.METRE)).divide(Units.SECOND 334 // .pow(2))))); 335 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 336 public static final Unit<Energy> ERG = addUnit(new ProductUnit<Energy>(DYNE.multiply(CENTI(Units.METRE)))); 337 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 338 public static final Unit<DynamicViscosity> POISE = addUnit( 339 new ProductUnit<DynamicViscosity>(DYNE.multiply(SECOND).divide(CENTI(Units.METRE).pow(2)))); 340 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 341 public static final Unit<ElectricCurrent> BIOT = addUnit(AMPERE.multiply(10)); 342 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 343 public static final Unit<KinematicViscosity> STOKES = addUnit( 344 new ProductUnit<KinematicViscosity>(CENTI(Units.METRE).pow(2).divide(Units.SECOND))); 345 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 346 public static final Unit<MagneticFlux> MAXWELL = addUnit(Units.WEBER.divide(1E8)); 347 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 348 public static final Unit<MagneticFluxDensity> GAUSS = addUnit(Units.TESLA.divide(1E4)); 349 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 350 public static final Unit<MagneticFieldStrength> OERSTED = addUnit( 351 new ProductUnit<MagneticFieldStrength>(SI.AMPERE_PER_METRE.multiply(250).divide(PI))); 352 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 353 public static final Unit<MagnetomotiveForce> GILBERT = addUnit( 354 new ProductUnit<MagnetomotiveForce>(OERSTED.multiply(CENTI(Units.METRE)))); 355 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 356 public static final Unit<Luminance> STILB = addUnit( 357 new ProductUnit<Luminance>(CANDELA.divide(CENTI(METER).pow(2)))); 358 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 359 public static final Unit<Luminance> LAMBERT = addUnit(new ProductUnit<Luminance>(STILB.divide(PI))); 360 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 361 public static final Unit<Illuminance> PHOT = addUnit(LUX.divide(1E4)); 362 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 363 public static final Unit<Radioactivity> CURIE = addUnit(Units.BECQUEREL.multiply(3.7E10)); 364 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 365 public static final Unit<IonizingRadiation> ROENTGEN = addUnit(SI.COULOMB_PER_KILOGRAM.multiply(2.58E-4)); 366 // add later when JMQ issue fixed 367 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 368 public static final Unit<RadiationDoseAbsorbed> RAD = addUnit( 369 new ProductUnit<RadiationDoseAbsorbed>(ERG.divide(Units.GRAM.multiply(100)))); 370 // public static final Unit<RadiationDoseAbsorbed> RAD = addUnit(new 371 // ProductUnit<RadiationDoseAbsorbed>( 372 // ERG.divide(Units.GRAM).multiply(100))); 373 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 374 public static final Unit<RadiationDoseEffective> REM = addUnit( 375 new ProductUnit<RadiationDoseEffective>(ERG.divide(Units.GRAM.multiply(100)))); 376 // public static final Unit<RadiationDoseEffective> REM = addUnit(new 377 // AlternateUnit<RadiationDoseEffective>( 378 // RAD, RAD.getSymbol())); // TODO are symbols for RAD and REM same? 379 ///////////////////////////////////////////////// 380 // INTERNATIONAL CUSTOMARY UNITS: UCUM 4.4 §34 // 381 ///////////////////////////////////////////////// 382 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 383 public static final Unit<Length> INCH_INTERNATIONAL = addUnit(CENTI(METER).multiply(254).divide(100)); 384 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 385 public static final Unit<Length> FOOT_INTERNATIONAL = addUnit(INCH_INTERNATIONAL.multiply(12)); 386 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 387 public static final Unit<Length> YARD_INTERNATIONAL = addUnit(FOOT_INTERNATIONAL.multiply(3)); 388 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 389 public static final Unit<Length> MILE_INTERNATIONAL = addUnit(FOOT_INTERNATIONAL.multiply(5280)); 390 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 391 public static final Unit<Length> FATHOM_INTERNATIONAL = addUnit(FOOT_INTERNATIONAL.multiply(6)); 392 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 393 public static final Unit<Length> NAUTICAL_MILE_INTERNATIONAL = addUnit(METER.multiply(1852)); 394 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 395 public static final Unit<Speed> KNOT_INTERNATIONAL = addUnit( 396 new ProductUnit<Speed>(NAUTICAL_MILE_INTERNATIONAL.divide(HOUR))); 397 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 398 public static final Unit<Area> SQUARE_INCH_INTERNATIONAL = addUnit( 399 new ProductUnit<Area>(INCH_INTERNATIONAL.pow(2))); 400 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 401 public static final Unit<Area> SQUARE_FOOT_INTERNATIONAL = addUnit( 402 new ProductUnit<Area>(FOOT_INTERNATIONAL.pow(2))); 403 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 404 public static final Unit<Area> SQUARE_YARD_INTERNATIONAL = addUnit( 405 new ProductUnit<Area>(YARD_INTERNATIONAL.pow(2))); 406 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 407 public static final Unit<Volume> CUBIC_INCH_INTERNATIONAL = addUnit( 408 new ProductUnit<Volume>(INCH_INTERNATIONAL.pow(3))); 409 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 410 public static final Unit<Volume> CUBIC_FOOT_INTERNATIONAL = addUnit( 411 new ProductUnit<Volume>(FOOT_INTERNATIONAL.pow(3))); 412 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 413 public static final Unit<Volume> CUBIC_YARD_INTERNATIONAL = addUnit( 414 new ProductUnit<Volume>(YARD_INTERNATIONAL.pow(3))); 415 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 416 public static final Unit<Volume> BOARD_FOOT_INTERNATIONAL = addUnit(CUBIC_INCH_INTERNATIONAL.multiply(144)); 417 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 418 public static final Unit<Volume> CORD_INTERNATIONAL = addUnit(CUBIC_FOOT_INTERNATIONAL.multiply(128)); 419 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 420 public static final Unit<Length> MIL_INTERNATIONAL = addUnit(INCH_INTERNATIONAL.divide(1000)); 421 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 422 public static final Unit<Area> CIRCULAR_MIL_INTERNATIONAL = addUnit( 423 new ProductUnit<Area>(MIL_INTERNATIONAL.pow(2).multiply(PI.divide(4)))); 424 // public static final Unit<Area> CIRCULAR_MIL_INTERNATIONAL = addUnit(new 425 // ProductUnit<Area>( 426 // MIL_INTERNATIONAL.pow(2).multiply(PI).divide(4))); 427 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 428 public static final Unit<Length> HAND_INTERNATIONAL = addUnit(INCH_INTERNATIONAL.multiply(4)); 429 ////////////////////////////////////////// 430 // US SURVEY LENGTH UNITS: UCUM 4.4 §35 // 431 ////////////////////////////////////////// 432 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 433 public static final Unit<Length> FOOT_US_SURVEY = addUnit(METER.multiply(1200).divide(3937)); 434 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 435 public static final Unit<Length> YARD_US_SURVEY = addUnit(FOOT_US_SURVEY.multiply(3)); 436 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 437 public static final Unit<Length> INCH_US_SURVEY = addUnit(FOOT_US_SURVEY.divide(12)); 438 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 439 public static final Unit<Length> ROD_US_SURVEY = addUnit(FOOT_US_SURVEY.multiply(33).divide(2)); 440 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 441 public static final Unit<Length> CHAIN_US_SURVEY = addUnit(ROD_US_SURVEY.multiply(4)); 442 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 443 public static final Unit<Length> LINK_US_SURVEY = addUnit(CHAIN_US_SURVEY.divide(100)); 444 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 445 public static final Unit<Length> RAMDEN_CHAIN_US_SURVEY = addUnit(FOOT_US_SURVEY.multiply(100)); 446 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 447 public static final Unit<Length> RAMDEN_LINK_US_SURVEY = addUnit(CHAIN_US_SURVEY.divide(100)); 448 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 449 public static final Unit<Length> FATHOM_US_SURVEY = addUnit(FOOT_US_SURVEY.multiply(6)); 450 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 451 public static final Unit<Length> FURLONG_US_SURVEY = addUnit(ROD_US_SURVEY.multiply(40)); 452 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 453 public static final Unit<Length> MILE_US_SURVEY = addUnit(FURLONG_US_SURVEY.multiply(8)); 454 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 455 public static final Unit<Area> ACRE_US_SURVEY = addUnit(new ProductUnit<Area>(ROD_US_SURVEY.pow(2)).multiply(160)); 456 // public static final Unit<Area> ACRE_US_SURVEY = addUnit(new 457 // ProductUnit<Area>( 458 // ROD_US_SURVEY.pow(2).multiply(160))); 459 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 460 public static final Unit<Area> SQUARE_ROD_US_SURVEY = addUnit(new ProductUnit<Area>(ROD_US_SURVEY.pow(2))); 461 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 462 public static final Unit<Area> SQUARE_MILE_US_SURVEY = addUnit(new ProductUnit<Area>(MILE_US_SURVEY.pow(2))); 463 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 464 public static final Unit<Area> SECTION_US_SURVEY = addUnit(new ProductUnit<Area>(MILE_US_SURVEY.pow(2))); 465 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 466 public static final Unit<Area> TOWNSHP_US_SURVEY = addUnit(SECTION_US_SURVEY.multiply(36)); 467 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 468 public static final Unit<Length> MIL_US_SURVEY = addUnit(INCH_US_SURVEY.divide(1000)); 469 ///////////////////////////////////////////////// 470 // BRITISH IMPERIAL LENGTH UNITS: UCUM 4.4 §36 // 471 ///////////////////////////////////////////////// 472 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 473 public static final Unit<Length> INCH_BRITISH = addUnit(CENTI(METER).multiply(2539998).divide(1000000)); 474 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 475 public static final Unit<Length> FOOT_BRITISH = addUnit(INCH_BRITISH.multiply(12)); 476 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 477 public static final Unit<Length> ROD_BRITISH = addUnit(FOOT_BRITISH.multiply(33).divide(2)); 478 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 479 public static final Unit<Length> CHAIN_BRITISH = addUnit(ROD_BRITISH.multiply(4)); 480 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 481 public static final Unit<Length> LINK_BRITISH = addUnit(CHAIN_BRITISH.divide(100)); 482 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 483 public static final Unit<Length> FATHOM_BRITISH = addUnit(FOOT_BRITISH.multiply(6)); 484 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 485 public static final Unit<Length> PACE_BRITISH = addUnit(FOOT_BRITISH.multiply(5).divide(2)); 486 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 487 public static final Unit<Length> YARD_BRITISH = addUnit(FOOT_BRITISH.multiply(3)); 488 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 489 public static final Unit<Length> MILE_BRITISH = addUnit(FOOT_BRITISH.multiply(5280)); 490 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 491 public static final Unit<Length> NAUTICAL_MILE_BRITISH = addUnit(FOOT_BRITISH.multiply(6080)); 492 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 493 public static final Unit<Speed> KNOT_BRITISH = addUnit(new ProductUnit<Speed>(NAUTICAL_MILE_BRITISH.divide(HOUR))); 494 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 495 public static final Unit<Area> ACRE_BRITISH = addUnit(new ProductUnit<Area>(YARD_BRITISH.pow(2)).multiply(4840)); 496 // public static final Unit<Area> ACRE_BRITISH = addUnit(new 497 // ProductUnit<Area>( 498 // YARD_BRITISH.pow(2).multiply(4840))); 499 /////////////////////////////////// 500 // US VOLUME UNITS: UCUM 4.4 §37 // 501 /////////////////////////////////// 502 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 503 public static final Unit<Volume> GALLON_US = addUnit(CUBIC_INCH_INTERNATIONAL.multiply(231), "Queen Anne's wine gallon", "gal_us"); 504 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 505 public static final Unit<Volume> BARREL_US = addUnit(GALLON_US.multiply(42), "barrel", "bbl_us"); 506 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 507 public static final Unit<Volume> QUART_US = addUnit(GALLON_US.divide(4)); 508 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 509 public static final Unit<Volume> PINT_US = addUnit(QUART_US.divide(2)); 510 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 511 public static final Unit<Volume> GILL_US = addUnit(PINT_US.divide(4)); 512 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 513 public static final Unit<Volume> FLUID_OUNCE_US = addUnit(GILL_US.divide(4)); 514 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 515 public static final Unit<Volume> FLUID_DRAM_US = addUnit(FLUID_OUNCE_US.divide(8)); 516 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 517 public static final Unit<Volume> MINIM_US = addUnit(FLUID_DRAM_US.divide(60)); 518 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 519 public static final Unit<Volume> CORD_US = addUnit(CUBIC_FOOT_INTERNATIONAL.multiply(128)); 520 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 521 public static final Unit<Volume> BUSHEL_US = addUnit(CUBIC_INCH_INTERNATIONAL.multiply(215042).divide(100)); 522 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 523 public static final Unit<Volume> GALLON_WINCHESTER = addUnit(BUSHEL_US.divide(8)); 524 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 525 public static final Unit<Volume> PECK_US = addUnit(BUSHEL_US.divide(4)); 526 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 527 public static final Unit<Volume> DRY_QUART_US = addUnit(PECK_US.divide(8)); 528 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 529 public static final Unit<Volume> DRY_PINT_US = addUnit(DRY_QUART_US.divide(2)); 530 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 531 public static final Unit<Volume> TABLESPOON_US = addUnit(FLUID_OUNCE_US.divide(2)); 532 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 533 public static final Unit<Volume> TEASPOON_US = addUnit(TABLESPOON_US.divide(3)); 534 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 535 public static final Unit<Volume> CUP_US = addUnit(TABLESPOON_US.multiply(16)); 536 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 537 public static final Unit<Volume> METRIC_FLUID_OUNCE_US = addUnit(MILLI(LITER).multiply(30)); 538 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 539 public static final Unit<Volume> METRIC_CUP_US = addUnit(MILLI(LITER).multiply(240)); 540 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 541 public static final Unit<Volume> METRIC_TEASPOON_CUP_US = addUnit(MILLI(LITER).multiply(5)); 542 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 543 public static final Unit<Volume> METRIC_TABLESPOON_CUP_US = addUnit(MILLI(LITER).multiply(15)); 544 ///////////////////////////////////////////////// 545 // BRITISH IMPERIAL VOLUME UNITS: UCUM 4.4 §38 // 546 ///////////////////////////////////////////////// 547 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 548 public static final Unit<Volume> GALLON_BRITISH = addUnit(LITER.multiply(454609).divide(100000)); 549 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 550 public static final Unit<Volume> PECK_BRITISH = addUnit(GALLON_BRITISH.multiply(2)); 551 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 552 public static final Unit<Volume> BUSHEL_BRITISH = addUnit(PECK_BRITISH.multiply(4)); 553 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 554 public static final Unit<Volume> QUART_BRITISH = addUnit(GALLON_BRITISH.divide(4)); 555 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 556 public static final Unit<Volume> PINT_BRITISH = addUnit(QUART_BRITISH.divide(2)); 557 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 558 public static final Unit<Volume> GILL_BRITISH = addUnit(PINT_BRITISH.divide(4)); 559 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 560 public static final Unit<Volume> FLUID_OUNCE_BRITISH = addUnit(GILL_BRITISH.divide(5)); 561 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 562 public static final Unit<Volume> FLUID_DRAM_BRITISH = addUnit(FLUID_OUNCE_BRITISH.divide(8)); 563 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 564 public static final Unit<Volume> MINIM_BRITISH = addUnit(FLUID_DRAM_BRITISH.divide(60)); 565 //////////////////////////////////////////// 566 // AVOIRDUPOIS WIEGHT UNITS: UCUM 4.4 §39 // 567 //////////////////////////////////////////// 568 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 569 public static final Unit<Mass> GRAIN = addUnit(MILLI(GRAM).multiply(6479891).divide(100000)); 570 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 571 public static final Unit<Mass> POUND = addUnit(GRAIN.multiply(7000)); 572 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 573 public static final Unit<Mass> OUNCE = addUnit(POUND.divide(16)); 574 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 575 public static final Unit<Mass> DRAM = addUnit(OUNCE.divide(16)); 576 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 577 public static final Unit<Mass> SHORT_HUNDREDWEIGHT = addUnit(POUND.multiply(100)); 578 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 579 public static final Unit<Mass> LONG_HUNDREDWEIGHT = addUnit(POUND.multiply(112)); 580 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 581 public static final Unit<Mass> SHORT_TON = addUnit(SHORT_HUNDREDWEIGHT.multiply(20)); 582 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 583 public static final Unit<Mass> LONG_TON = addUnit(LONG_HUNDREDWEIGHT.multiply(20)); 584 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 585 public static final Unit<Mass> STONE = addUnit(POUND.multiply(14)); 586 // CONTINUED FROM SECTION §32 587 // contains a forward reference to POUND, so we had to move it here, below 588 // section §39 589 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 590 // public static final Unit<Force> POUND_FORCE = addUnit(new 591 // ProductUnit<Force>( 592 // POUND.multiply(ACCELERATION_OF_FREEFALL))); 593 public static final Unit<Force> POUND_FORCE = addUnit( 594 POUND.multiply(ACCELERATION_OF_FREEFALL).asType(Force.class)); 595 596 // public static final Unit<InformationRate> POUND_FORCE2 = 597 // addUnit(POUND.multiply(ACCELERATION_OF_FREEFALL).asType(InformationRate.class)); 598 599 ///////////////////////////////////// 600 // TROY WEIGHT UNITS: UCUM 4.4 §40 // 601 ///////////////////////////////////// 602 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 603 public static final Unit<Mass> PENNYWEIGHT_TROY = addUnit(GRAIN.multiply(24)); 604 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 605 public static final Unit<Mass> OUNCE_TROY = addUnit(PENNYWEIGHT_TROY.multiply(20)); 606 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 607 public static final Unit<Mass> POUND_TROY = addUnit(OUNCE_TROY.multiply(12)); 608 ///////////////////////////////////////////// 609 // APOTECARIES' WEIGHT UNITS: UCUM 4.4 §41 // 610 ///////////////////////////////////////////// 611 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 612 public static final Unit<Mass> SCRUPLE_APOTHECARY = addUnit(GRAIN.multiply(20)); 613 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 614 public static final Unit<Mass> DRAM_APOTHECARY = addUnit(SCRUPLE_APOTHECARY.multiply(3)); 615 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 616 public static final Unit<Mass> OUNCE_APOTHECARY = addUnit(DRAM_APOTHECARY.multiply(8)); 617 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 618 public static final Unit<Mass> POUND_APOTHECARY = addUnit(OUNCE_APOTHECARY.multiply(12)); 619 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 620 public static final Unit<Mass> METRIC_OUNCE = addUnit(GRAM.multiply(28)); 621 622 ///////////////////////////////////////////// 623 // TYPESETTER'S LENGTH UNITS: UCUM 4.4 §42 // 624 ///////////////////////////////////////////// 625 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 626 public static final Unit<Length> LINE = addUnit(INCH_INTERNATIONAL.divide(12)); 627 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 628 public static final Unit<Length> POINT = addUnit(LINE.divide(6)); 629 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 630 public static final Unit<Length> PICA = addUnit(POINT.multiply(12)); 631 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 632 public static final Unit<Length> POINT_PRINTER = addUnit(INCH_INTERNATIONAL.multiply(13837).divide(1000000)); 633 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 634 public static final Unit<Length> PICA_PRINTER = addUnit(POINT_PRINTER.multiply(12)); 635 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 636 public static final Unit<Length> PIED = addUnit(CENTI(METER).multiply(3248).divide(100)); 637 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 638 public static final Unit<Length> POUCE = addUnit(PIED.divide(12)); 639 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 640 public static final Unit<Length> LIGNE = addUnit(POUCE.divide(12)); 641 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 642 public static final Unit<Length> DIDOT = addUnit(LIGNE.divide(6)); 643 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 644 public static final Unit<Length> CICERO = addUnit(DIDOT.multiply(12)); 645 ////////////////////////////////////// 646 // OTHER LEGACY UNITS: UCUM 4.5 §43 // 647 ////////////////////////////////////// 648 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 649 public static final Unit<Temperature> RANKINE = addUnit(KELVIN.divide(9).multiply(5)); 650 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 651 public static final Unit<Temperature> FAHRENHEIT = addUnit(RANKINE.shift(459.67)); 652 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 653 public static final Unit<Temperature> REAUMUR = addUnit((KELVIN.multiply(4).divide(5)).shift(218.52)); 654 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 655 public static final Unit<Energy> CALORIE_AT_15C = addUnit(JOULE.multiply(41858).divide(10000)); 656 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 657 public static final Unit<Energy> CALORIE_AT_20C = addUnit(JOULE.multiply(41819).divide(10000)); 658 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 659 public static final Unit<Energy> CALORIE_MEAN = addUnit(JOULE.multiply(419002).divide(100000)); 660 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 661 public static final Unit<Energy> CALORIE_INTERNATIONAL_TABLE = addUnit(JOULE.multiply(41868).divide(10000)); 662 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 663 public static final Unit<Energy> CALORIE_THERMOCHEMICAL = addUnit(JOULE.multiply(4184).divide(1000)); 664 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 665 public static final Unit<Energy> CALORIE = addUnit(CALORIE_THERMOCHEMICAL); 666 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 667 public static final Unit<Energy> CALORIE_FOOD = addUnit(KILO(CALORIE_THERMOCHEMICAL)); 668 669 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 670 public static final Unit<Energy> BTU_AT_39F = addUnit(KILO(JOULE).multiply(105967).divide(100000)); 671 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 672 public static final Unit<Energy> BTU_AT_59F = addUnit(KILO(JOULE).multiply(105480).divide(100000)); 673 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 674 public static final Unit<Energy> BTU_AT_60F = addUnit(KILO(JOULE).multiply(105468).divide(100000)); 675 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 676 public static final Unit<Energy> BTU_MEAN = addUnit(KILO(JOULE).multiply(105587).divide(100000)); 677 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 678 public static final Unit<Energy> BTU_INTERNATIONAL_TABLE = addUnit( 679 KILO(JOULE).multiply(105505585262L).divide(100000000000L)); 680 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 681 public static final Unit<Energy> BTU_THERMOCHEMICAL = addUnit(KILO(JOULE).multiply(105435).divide(100000)); 682 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 683 public static final Unit<Energy> BTU = addUnit(BTU_THERMOCHEMICAL); 684 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 685 public static final Unit<Power> HORSEPOWER = addUnit( 686 new ProductUnit<Power>(FOOT_INTERNATIONAL.multiply(POUND_FORCE).divide(SECOND))); 687 688 //////////////////////////////////////////// 689 // CLINICAL MEDICINE UNITS: UCUM 4.5 §44 // 690 /////////////////////////////////////////// 691 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 692 public static final Unit<Pressure> METER_OF_WATER_COLUMN = addUnit(KILO(PASCAL).multiply(980665).divide(100000)); 693 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 694 public static final Unit<Pressure> METER_OF_MERCURY_COLUMN = addUnit(KILO(PASCAL).multiply(1333220).divide(10000)); 695 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 696 public static final Unit<Pressure> INCH_OF_WATER_COLUMN = addUnit( 697 new ProductUnit<Pressure>(METER_OF_WATER_COLUMN.multiply(INCH_INTERNATIONAL).divide(METER))); 698 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 699 public static final Unit<Pressure> INCH_OF_MERCURY_COLUMN = addUnit( 700 new ProductUnit<Pressure>(METER_OF_MERCURY_COLUMN.multiply(INCH_INTERNATIONAL).divide(METER))); 701 702 public static final Unit<Drag> PERIPHERAL_VASCULAR_RESISTANCE = addUnit( 703 MILLI(METER_OF_MERCURY_COLUMN).multiply(SECOND).divide(MILLI(LITER)).asType(Drag.class)); 704 public static final Unit<Drag> WOOD = addUnit(MILLI(METER_OF_MERCURY_COLUMN).multiply(MINUTE).divide(LITER).asType(Drag.class)); 705 // public static final Unit DIOPTER = addUnit(ONE.divide(METER)); 706 // public static final Unit PRISM_DIOPTER = 707 // addUnit(ONE.multiply(100).multiply(Math.tan(1))); 708 // public static final Unit PERCENT_OF_SLOPE = 709 // addUnit(ONE.multiply(100).multiply(Math.tan(1))); 710 // public static final Unit MESH = addUnit(ONE.divide(INCH_INTERNATIONAL)); 711 // public static final Unit CHARRIERE = addUnit(MILLI(METER).divide(3)); 712 713 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 714 public static final Unit<Volume> DROP = addUnit(MILLI(LITER).divide(20)); 715 716 // public static final Unit HOUNSFIELD = addUnit(ONE); 717 // public static final Unit METABOLIC_EQUIVALENT = 718 // addUnit(MILLI(LITER).divide(MINUTE).divide(KILO(GRAM))); 719 720 // public static final Unit HOMEOPATHIC_POTENCY_OF_DECIMAL = 721 // addUnit(ONE.multiply(-1).multiply(Math.log10(1))); 722 // public static final Unit HOMEOPATHIC_POTENCY_OF_CENTESIMAL = 723 // addUnit(ONE.multiply(-1).multiply(Math.log(1)).divide(Math.log(100))); 724 // public static final Unit HOMEOPATHIC_POTENCY_OF_MILLESIMAL = 725 // addUnit(ONE.multiply(-1).multiply(Math.log(1)).divide(Math.log(1000))); 726 // public static final Unit HOMEOPATHIC_POTENCY_OF_QUINTALLESIMAL = 727 // addUnit(ONE.multiply(-1).multiply(Math.log(1)).divide(Math.log(50000))); 728 729 // public static final Unit HOMEOPATHIC_POTENCY_OF_DECIMAL_HAHNEMANNIAN = 730 // UNDEFINED; 731 // public static final Unit HOMEOPATHIC_POTENCY_OF_CENTESIMAL_HAHNEMANNIAN = 732 // UNDEFINED; 733 // public static final Unit HOMEOPATHIC_POTENCY_OF_MILLESIMAL_HAHNEMANNIAN = 734 // UNDEFINED; 735 // public static final Unit 736 // HOMEOPATHIC_POTENCY_OF_QUINTAMILLESIMAL_HAHNEMANNIAN = UNDEFINED; 737 // public static final Unit HOMEOPATHIC_POTENCY_OF_DECIMAL_KORSAKOVIAN = 738 // UNDEFINED; 739 // public static final Unit HOMEOPATHIC_POTENCY_OF_CENTESIMAL_KORSAKOVIAN = 740 // UNDEFINED; 741 // public static final Unit HOMEOPATHIC_POTENCY_OF_MILLESIMAL_KORSAKOVIAN = 742 // UNDEFINED; 743 // public static final Unit 744 // HOMEOPATHIC_POTENCY_OF_QUINTAMILLESIMAL_KORSAKOVIAN = UNDEFINED; 745 746 ////////////////////////////////////////////////// 747 // CHEMICAL AND BIOCHEMICAL UNITS: UCUM 4.5 §45 // 748 ////////////////////////////////////////////////// 749 // public static final Unit EQUIVALENTS = addUnit(MOLE); 750 // public static final Unit OSMOLE = addUnit(MOLE); 751 752 public static final Unit<Acidity> PH = addUnit( 753 MOLE.divide(LITER).transform(new LogConverter(10)).multiply(-1).asType(Acidity.class)); 754 755 // @SuppressWarnings("unchecked") 756 @SuppressWarnings("unchecked") 757 public static final Unit<Concentration<Mass>> GRAM_PERCENT = addUnit( 758 GRAM.divide(DECI(LITER)).asType(Concentration.class)); 759 760 // public static final Unit SVEDBERG = addUnit(SECOND.multiply(1E-13)); 761 762 public static final Unit<Dimensionless> HIGH_POWER_FIELD = addUnit(ONE); 763 public static final Unit<Dimensionless> LOW_POWER_FIELD = addUnit(ONE.multiply(100)); 764 765 // public static final Unit KATAL = addUnit(MOLE.divide(SECOND)); 766 // public static final Unit UNIT = addUnit(MICRO(MOLE).divide(MINUTE)); 767 768 // public static final Unit INTERNATIONAL_UNIT = UNDEFINED; 769 // public static final Unit ARBITRARY_UNIT = UNDEFINED; 770 // public static final Unit US_PHARMACOPEIA = UNDEFINED; 771 // public static final Unit GPL = UNDEFINED; 772 // public static final Unit MPL = UNDEFINED; 773 // public static final Unit APL = UNDEFINED; 774 // public static final Unit BETHESDA = UNDEFINED; 775 // public static final Unit ANTI_FACTOR_XA = UNDEFINED; 776 // public static final Unit TODD = UNDEFINED; 777 // public static final Unit DYE = UNDEFINED; 778 // public static final Unit SOMOGYI = UNDEFINED; 779 // public static final Unit BODANSKY = UNDEFINED; 780 // public static final Unit KING_ARMSTRONG = UNDEFINED; 781 // public static final Unit KUNKEL = UNDEFINED; 782 // public static final Unit MAC_LAGAN = UNDEFINED; 783 // public static final Unit TUBERCULIN = UNDEFINED; 784 // public static final Unit CELL_CULTURE_INFECTIOUS_50_PERCENT_DOSE = 785 // UNDEFINED; 786 // public static final Unit TISSUE_CULTURE_INFECTIOUS_50_PERCENT_DOSE = 787 // UNDEFINED; 788 // public static final Unit EMBRYO_CULTURE_INFECTIOUS_50_PERCENT_DOSE = 789 // UNDEFINED; 790 // public static final Unit PLAQUE_FORMING = UNDEFINED; 791 // public static final Unit FOCUS_FORMING = UNDEFINED; 792 // public static final Unit COLONY_FORMING = UNDEFINED; 793 // public static final Unit INDEX_OF_REACTIVITY = UNDEFINED; 794 // public static final Unit BIOEQUIVALENT_ALLERGEN = UNDEFINED; 795 // public static final Unit ALLERGEN = UNDEFINED; 796 // public static final Unit ALLERGEN_FOR_AMBROSIA_ARTEMISIIFOLIA = 797 // UNDEFINED; 798 // public static final Unit PROTEIN_NITROGEN = UNDEFINED; 799 // public static final Unit LIMIT_OF_FLOCCULATION = UNDEFINED; 800 // public static final Unit D_ANTIGEN = UNDEFINED; 801 // public static final Unit FIBRINOGEN_EQUIVALENT = UNDEFINED; 802 // public static final Unit ELISA = UNDEFINED; 803 // public static final Unit EHRLICH = UNDEFINED; 804 // public static final Unit CHEMICAL = UNDEFINED; 805 806 ///////////////////////////////// 807 // LEVELS UNITS: UCUM 4.5 §46 // 808 //////////////////////////////// 809 @SuppressWarnings({ "unchecked", "rawtypes" }) 810 public static final Unit<Level<Dimensionless>> NEPER = (Unit) addUnit( 811 ONE.transform(new LogConverter(Math.E))); 812 /** 813 * A logarithmic unit used to describe a power {@link Level} ratio (standard 814 * name <code>dB</code>). 815 */ 816 // public static final Unit<Level<Power>> DECIBEL = addUnit(NEPER 817 // .transform(new LogConverter(10).inverse().concatenate( 818 // RationalConverter.of(1d, 10d)))); 819 820 @SuppressWarnings({ "unchecked", "rawtypes" }) 821 public static final Unit<Level<Dimensionless>> BEL = (Unit) addUnit( 822 ONE.transform(new LogConverter(10))); 823 824 @SuppressWarnings("unchecked") 825 public static final Unit<Level<Pressure>> BEL_SOUND = addUnit( 826 PASCAL.divide(1E5).multiply(2).transform(new LogConverter(10)).multiply(2).asType(Level.class)); 827 828 @SuppressWarnings("unchecked") 829 public static final Unit<Level<ElectricPotential>> BEL_VOLT = addUnit( 830 VOLT.transform(new LogConverter(10)).multiply(2).asType(Level.class)); 831 832 @SuppressWarnings("unchecked") 833 public static final Unit<Level<ElectricPotential>> BEL_MILLIVOLT = addUnit( 834 MILLI(VOLT).transform(new LogConverter(10)).multiply(2).asType(Level.class)); 835 836 @SuppressWarnings("unchecked") 837 public static final Unit<Level<ElectricPotential>> BEL_MICROVOLT = addUnit( 838 MICRO(VOLT).transform(new LogConverter(10)).multiply(2).asType(Level.class)); 839 840 @SuppressWarnings("unchecked") 841 public static final Unit<Level<ElectricPotential>> BEL_10_NANOVOLT = addUnit( 842 NANO(VOLT).multiply(10).transform(new LogConverter(10)).multiply(2).asType(Level.class)); 843 844 @SuppressWarnings("unchecked") 845 public static final Unit<Level<ElectricPotential>> BEL_WATT = addUnit( 846 WATT.transform(new LogConverter(10)).asType(Level.class)); 847 848 @SuppressWarnings("unchecked") 849 public static final Unit<Level<ElectricPotential>> BEL_KILOWATT = addUnit( 850 KILO(WATT).transform(new LogConverter(10)).asType(Level.class)); 851 852 /////////////////////////////////////// 853 // MISCELLANEOUS UNITS: UCUM 4.5 §47 // 854 /////////////////////////////////////// 855 /** temporary helper for MHO */ 856 private static final Unit<? extends Quantity<?>> TMP_MHO = SIEMENS.alternate("mho"); 857 858 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 859 //public static final Unit<Volume> STERE = addUnit(new ProductUnit<Volume>(METER.pow(3))); 860 public static final Unit<Volume> STERE = addUnit(new TransformedUnit<Volume>("st", Units.CUBIC_METRE, Units.CUBIC_METRE, MultiplyConverter.IDENTITY)); 861 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 862 public static final Unit<Length> ANGSTROM = addUnit(NANO(METER).divide(10)); 863 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 864 public static final Unit<Area> BARN = addUnit(new ProductUnit<Area>(FEMTO(METER).pow(2)).multiply(100)); 865 // public static final Unit<Area> BARN = addUnit(new 866 // ProductUnit<Area>(FEMTO( 867 // METER).pow(2).multiply(100))); 868 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 869 public static final Unit<Pressure> ATMOSPHERE_TECHNICAL = addUnit( 870 new ProductUnit<Pressure>(KILO(GRAM_FORCE).divide(CENTI(METER).pow(2)))); 871 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 872 public static final Unit<ElectricConductance> MHO = addUnit( 873 new AlternateUnit<ElectricConductance>(TMP_MHO, TMP_MHO.getSymbol())); 874 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 875 public static final Unit<Pressure> POUND_PER_SQUARE_INCH = addUnit( 876 new ProductUnit<Pressure>(POUND_FORCE.divide(INCH_INTERNATIONAL.pow(2)))); 877 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 878 public static final Unit<Angle> CIRCLE = addUnit(new ProductUnit<Angle>(PI.multiply(RADIAN.multiply(2)))); 879 // public static final Unit<Angle> CIRCLE = addUnit(new 880 // ProductUnit<Angle>(PI 881 // .multiply(RADIAN).multiply(2))); 882 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 883 public static final Unit<SolidAngle> SPHERE = addUnit( 884 new ProductUnit<SolidAngle>(PI.multiply(STERADIAN.multiply(4)))); 885 // public static final Unit<SolidAngle> SPHERE = addUnit(new 886 // ProductUnit<SolidAngle>( 887 // PI.multiply(STERADIAN).multiply(4))); 888 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 889 public static final Unit<Mass> CARAT_METRIC = addUnit(GRAM.divide(5)); 890 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 891 public static final Unit<Dimensionless> CARAT_GOLD = addUnit(ONE.divide(24)); 892 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 893 public static final Unit<Length> SMOOT = addUnit(INCH_INTERNATIONAL.multiply(67)); 894 895 //////////////////////////////////////////////// 896 // INFORMATION TECHNOLOGY UNITS: UCUM 4.6 §48 // 897 //////////////////////////////////////////////// 898 /** 899 * The unit for binary information (standard name <code>bit</code>). 900 * As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. 901 */ 902 public static final Unit<Information> BIT = addUnit(new AlternateUnit<Information>(ONE, "bit"), Information.class); 903 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 904 public static final Unit<Information> BYTE = addUnit(BIT.multiply(8)); 905 /** 906 * The SI unit for binary information rate (standard name 907 * <code>bit/s</code>). 908 */ 909 protected static final Unit<InformationRate> BITS_PER_SECOND = addUnit( 910 new ProductUnit<InformationRate>(BIT.divide(SECOND)), InformationRate.class); 911 /** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */ 912 public static final Unit<InformationRate> BAUD = addUnit(BITS_PER_SECOND); 913 914 ///////////////////// 915 // Collection View // 916 ///////////////////// 917 918 @Override 919 public String getName() { 920 return "Unified Code for Units of Measure"; 921 } 922 923 private static <U extends Unit<Q>, Q extends Quantity<Q>> U addUnit(U unit) { 924 INSTANCE.units.add(unit); 925 return unit; 926 } 927 928 /** 929 * Adds a new unit and maps it to the specified quantity type. 930 * 931 * @param unit 932 * the unit being added. 933 * @param type 934 * the quantity type. 935 * @return <code>unit</code>. 936 */ 937 private static <U extends AbstractUnit<?>> U addUnit(U unit, Class<? extends Quantity<?>> type) { 938 INSTANCE.units.add(unit); 939 INSTANCE.quantityToUnit.put(type, unit); 940 return unit; 941 } 942 943 /** 944 * Adds a new unit not mapped to any specified quantity type and puts a text 945 * as symbol or label. 946 * 947 * @param unit 948 * the unit being added. 949 * @param name 950 * the string to use as name 951 * @param text 952 * the string to use as label or symbol 953 * @param isLabel 954 * if the string should be used as a label or not 955 * @return <code>unit</code>. 956 */ 957 private static <U extends Unit<?>> U addUnit(U unit, String name, String text, boolean isLabel) { 958 if (isLabel) { 959 SimpleUnitFormat.getInstance().label(unit, text); 960 } 961 if (name != null && unit instanceof AbstractUnit) { 962 return Helper.addUnit(INSTANCE.units, unit, name); 963 } else { 964 INSTANCE.units.add(unit); 965 } 966 return unit; 967 } 968 969 970 /** 971 * Adds a new unit not mapped to any specified quantity type and puts a text 972 * as label. 973 * 974 * @param unit 975 * the unit being added. 976 * @param name 977 * the string to use as name 978 * @param text 979 * the string to use as label 980 * @return <code>unit</code>. 981 */ 982 private static <U extends Unit<?>> U addUnit(U unit, String name, String text) { 983 return addUnit(unit, name, text, true); 984 } 985 986 //////////////////////////////////////////////////////////////////////////// 987 // Label adjustments for UCUM system 988 static { 989 SimpleUnitFormat.getInstance().label(ATOMIC_MASS_UNIT, "AMU"); 990 //SimpleUnitFormat.getInstance().label(LITER, "L"); 991 //SimpleUnitFormat.getInstance().label(LITER_DM3, "l"); 992 SimpleUnitFormat.getInstance().label(OUNCE, "oz"); 993 SimpleUnitFormat.getInstance().label(POUND, "lb"); 994 SimpleUnitFormat.getInstance().label(PLANCK, "h"); 995 // TODO maybe we can find a better solution, but it would require to 996 // "harvest" the entire UCUMFormat ResourceBundle and label every 997 // matching UCUM unit in a loop. 998 } 999}