All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tec.units.ri.spi.SI Maven / Gradle / Ivy

/**
 *  Unit-API - Units of Measurement API for Java
 *  Copyright (c) 2005-2015, Jean-Marie Dautelle, Werner Keil, V2COM.
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of JSR-363 nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package tec.units.ri.spi;

import static tec.units.ri.AbstractUnit.ONE;

import java.util.HashMap;

import javax.measure.Quantity;
import javax.measure.Unit;
import javax.measure.quantity.*;

import tec.units.ri.AbstractSystemOfUnits;
import tec.units.ri.AbstractUnit;
import tec.units.ri.function.AddConverter;
import tec.units.ri.function.LogConverter;
import tec.units.ri.function.MultiplyConverter;
import tec.units.ri.function.PiMultiplierConverter;
import tec.units.ri.function.RationalConverter;
import tec.units.ri.quantity.QuantityDimension;
import tec.units.ri.unit.AlternateUnit;
import tec.units.ri.unit.BaseUnit;
import tec.units.ri.unit.ProductUnit;
import tec.units.ri.unit.TransformedUnit;


/**
 * 

This class defines all SI (Système International d'Unités) base units and * derived units as well as units that are accepted for use with the * SI units.

* * @see Wikipedia: International System of Units * @see SI 2006 - Official Specification * @see SIPrefix * * @author Jean-Marie Dautelle * @author Werner Keil * @version 0.5.3, January 19, 2015 */ public final class SI extends AbstractSystemOfUnits { /** * The singleton instance. */ private static final SI INSTANCE = new SI(); /** * Holds the mapping quantity to unit. */ private final HashMap, AbstractUnit> quantityToUnit = new HashMap, AbstractUnit>(); /** * Default constructor (prevents this class from being instantiated). */ private SI() { } /** * Returns the singleton instance of this class. * * @return the metric system instance. */ public static SI getInstance() { return INSTANCE; } //////////////// // BASE UNITS // //////////////// /** * The SI base unit for electric current quantities (standard name A). * The Ampere is that constant current which, if maintained in two straight * parallel conductors of infinite length, of negligible circular * cross-section, and placed 1 meter apart in vacuum, would produce between * these conductors a force equal to 2 * 10-7 newton per meter of length. * It is named after the French physicist Andre Ampere (1775-1836). */ public static final Unit AMPERE = addUnit(new BaseUnit("A", QuantityDimension.ELECTRIC_CURRENT), ElectricCurrent.class); /** * The SI base unit for luminous intensity quantities (standard name cd). * The candela is the luminous intensity, in a given direction, * of a source that emits monochromatic radiation of frequency * 540 * 1012 hertz and that has a radiant intensity in that * direction of 1/683 watt per steradian * @see * Wikipedia: Candela */ public static final Unit CANDELA = addUnit(new BaseUnit("cd", QuantityDimension.LUMINOUS_INTENSITY), LuminousIntensity.class); /** * The SI base unit for thermodynamic temperature quantities (standard name K). * The kelvin is the 1/273.16th of the thermodynamic temperature of the * triple point of water. It is named after the Scottish mathematician and * physicist William Thomson 1st Lord Kelvin (1824-1907) */ public static final Unit KELVIN = addUnit(new BaseUnit("K", QuantityDimension.TEMPERATURE), Temperature.class); /** * The SI base unit for mass quantities (standard name kg). * It is the only SI unit with a prefix as part of its name and symbol. * The kilogram is equal to the mass of an international prototype in the * form of a platinum-iridium cylinder kept at Sevres in France. * @see #GRAM */ public static final Unit KILOGRAM = addUnit(new BaseUnit("kg", QuantityDimension.MASS), Mass.class); /** * The SI base unit for length quantities (standard name m). * One metre was redefined in 1983 as the distance traveled by light in * a vacuum in 1/299,792,458 of a second. */ public static final Unit METRE = addUnit(new BaseUnit("m", QuantityDimension.LENGTH), Length.class); /** * The SI base unit for amount of substance quantities (standard name mol). * The mole is the amount of substance of a system which contains as many * elementary entities as there are atoms in 0.012 kilogram of carbon 12. */ public static final Unit MOLE = addUnit(new BaseUnit("mol", QuantityDimension.AMOUNT_OF_SUBSTANCE), AmountOfSubstance.class); /** * The SI base unit for duration quantities (standard name s). * It is defined as the duration of 9,192,631,770 cycles of radiation * corresponding to the transition between two hyperfine levels of * the ground state of cesium (1967 Standard). */ public static final Unit