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

tec.uom.se.unit.Units Maven / Gradle / Ivy

/*
 * Units of Measurement Implementation for Java SE
 * Copyright (c) 2005-2018, Jean-Marie Dautelle, Werner Keil, Otavio Santana.
 *
 * 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.uom.se.unit;

import static tec.uom.se.AbstractUnit.ONE;
import tec.uom.lib.common.function.Nameable;
import tec.uom.se.AbstractSystemOfUnits;
import tec.uom.se.AbstractUnit;
import tec.uom.se.function.AddConverter;
import tec.uom.se.function.PiMultiplierConverter;
import tec.uom.se.function.RationalConverter;
import tec.uom.se.quantity.QuantityDimension;

import javax.measure.Quantity;
import javax.measure.Unit;
import javax.measure.quantity.Acceleration;
import javax.measure.quantity.AmountOfSubstance;
import javax.measure.quantity.Angle;
import javax.measure.quantity.Area;
import javax.measure.quantity.CatalyticActivity;
import javax.measure.quantity.Dimensionless;
import javax.measure.quantity.ElectricCapacitance;
import javax.measure.quantity.ElectricCharge;
import javax.measure.quantity.ElectricConductance;
import javax.measure.quantity.ElectricCurrent;
import javax.measure.quantity.ElectricInductance;
import javax.measure.quantity.ElectricPotential;
import javax.measure.quantity.ElectricResistance;
import javax.measure.quantity.Energy;
import javax.measure.quantity.Force;
import javax.measure.quantity.Frequency;
import javax.measure.quantity.Illuminance;
import javax.measure.quantity.Length;
import javax.measure.quantity.LuminousFlux;
import javax.measure.quantity.LuminousIntensity;
import javax.measure.quantity.MagneticFlux;
import javax.measure.quantity.MagneticFluxDensity;
import javax.measure.quantity.Mass;
import javax.measure.quantity.Power;
import javax.measure.quantity.Pressure;
import javax.measure.quantity.RadiationDoseAbsorbed;
import javax.measure.quantity.RadiationDoseEffective;
import javax.measure.quantity.Radioactivity;
import javax.measure.quantity.SolidAngle;
import javax.measure.quantity.Speed;
import javax.measure.quantity.Temperature;
import javax.measure.quantity.Time;
import javax.measure.quantity.Volume;
import javax.measure.spi.SystemOfUnits;

/**
 * 

* This class defines commonly used units. * * @author Werner Keil * @version 1.0.5, October 23, 2017 * @since 1.0 */ public class Units extends AbstractSystemOfUnits implements Nameable { protected Units() { } private static final Units INSTANCE = new Units(); public String getName() { return Units.class.getSimpleName(); } // ////////////// // 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). * * @implNote SI Base Unit */ 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 * * @implNote SI Base Unit */ 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) * * @implNote SI Base Unit */ 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 * * @implNote SI Base Unit */ 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. * * @implNote SI Base Unit */ 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. * * @implNote SI Base Unit */ 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). * * @implNote SI Base Unit */ public static final Unit