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