
si.uom.NonSI Maven / Gradle / Ivy
The newest version!
/*
* International System of Units (SI)
* Copyright (c) 2005-2025, Jean-Marie Dautelle, Werner Keil and others.
*
* 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 SI System, Units of Measurement nor the names of their 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 si.uom;
import static javax.measure.MetricPrefix.CENTI;
import static javax.measure.MetricPrefix.MEGA;
import static si.uom.SI.AVOGADRO_CONSTANT_VALUE;
import static si.uom.SI.ELEMENTARY_CHARGE_VALUE;
import static tech.units.indriya.AbstractUnit.ONE;
import static tech.units.indriya.unit.Units.BECQUEREL;
import static tech.units.indriya.unit.Units.DAY;
import static tech.units.indriya.unit.Units.COULOMB;
import static tech.units.indriya.unit.Units.JOULE;
import static tech.units.indriya.unit.Units.GRAM;
import static tech.units.indriya.unit.Units.KILOGRAM;
import static tech.units.indriya.unit.Units.METRE;
import static tech.units.indriya.unit.Units.METRE_PER_SECOND;
import static tech.units.indriya.unit.Units.MOLE;
import static tech.units.indriya.unit.Units.PASCAL;
import static tech.units.indriya.unit.Units.RADIAN;
import static tech.units.indriya.unit.Units.SECOND;
import static tech.units.indriya.unit.Units.SIEVERT;
import static tech.units.indriya.unit.Units.STERADIAN;
import static tech.units.indriya.unit.Units.SQUARE_METRE;
import javax.measure.Unit;
import javax.measure.quantity.AmountOfSubstance;
import javax.measure.quantity.Angle;
import javax.measure.quantity.Area;
import javax.measure.quantity.Dimensionless;
import javax.measure.quantity.ElectricCharge;
import javax.measure.quantity.Energy;
import javax.measure.quantity.Frequency;
import javax.measure.quantity.Length;
import javax.measure.quantity.Mass;
import javax.measure.quantity.Pressure;
import javax.measure.quantity.RadiationDoseEffective;
import javax.measure.quantity.Radioactivity;
import javax.measure.quantity.SolidAngle;
import javax.measure.quantity.Speed;
import javax.measure.quantity.Time;
import si.uom.quantity.DynamicViscosity;
import si.uom.quantity.IonizingRadiation;
import si.uom.quantity.KinematicViscosity;
import si.uom.quantity.Level;
import tech.units.indriya.AbstractSystemOfUnits;
import tech.units.indriya.AbstractUnit;
import tech.units.indriya.format.EBNFUnitFormat;
import tech.units.indriya.format.SimpleUnitFormat;
import tech.units.indriya.function.AbstractConverter;
import tech.units.indriya.function.LogConverter;
import tech.units.indriya.function.MultiplyConverter;
import tech.units.indriya.unit.TransformedUnit;
/**
*
* This class contains units that are not part of the International System of
* Units, that is, they are outside the SI, but some are still widely used.
*
*
* @noextend This class is not intended to be extended by clients.
*
* @author Jean-Marie Dautelle
* @author Werner Keil
* @version 2.2.3, March 19, 2025
* @see Wikipedia:
* Non-SI units mentioned in the SI
*/
public final class NonSI extends AbstractSystemOfUnits {
private static final String SYSTEM_NAME = "Non-SI Units";
private static final NonSI INSTANCE = new NonSI();
/////////////////////////////////////////////////////////////////
// Units outside the SI that are accepted for use with the SI. //
/////////////////////////////////////////////////////////////////
///////////////////
// Dimensionless //
///////////////////
/**
* A dimensionless unit equals to pi
(standard name
* π
).
* @deprecated Not supported with the SI anymore, will be moved to another module into ObsoleteUnits or similar
*/
public static final Unit PI = addUnit(ONE.multiply(StrictMath.PI), "Pi", "pi");
/**
* An angle unit accepted for use with SI units (standard name
* deg
).
*/
public static final Unit DEGREE_ANGLE = addUnit(
new TransformedUnit(RADIAN, MultiplyConverter.ofPiExponent(1).concatenate(MultiplyConverter.ofRational(1, 180))),
"Degree Angle", "deg");
/**
* An angle unit accepted for use with SI units (standard name '
).
*/
public static final Unit MINUTE_ANGLE = addUnit(new TransformedUnit(RADIAN,
MultiplyConverter.ofPiExponent(1).concatenate(MultiplyConverter.ofRational(1, 180 * 60))), "Minute Angle", "'");
/**
* An angle unit accepted for use with SI units (standard name ''
).
*/
public static final Unit SECOND_ANGLE = addUnit(
new TransformedUnit(RADIAN,
MultiplyConverter.ofPiExponent(1).concatenate(MultiplyConverter.ofRational(1, 180 * 60 * 60))),
"Second Angle", "''");
/**
* An energy unit accepted for use with SI units (standard name
* eV
). The electronvolt is the kinetic energy acquired by an
* electron passing through a potential difference of 1 V in vacuum. The value
* must be obtained by experiment, and is therefore not known exactly.
*/
public static final Unit ELECTRON_VOLT = addUnit(
new TransformedUnit(JOULE, MultiplyConverter.of(1.602176487E-19)), "Electron Volt", "eV");
// CODATA 2006 - http://physics.nist.gov/cuu/Constants/codata.pdf
/**
* A mass unit accepted for use with SI units (standard name u
).
* The unified atomic mass unit is equal to 1/12 of the mass of an unbound atom
* of the nuclide 12C, at rest and in its ground state. The value must be
* obtained by experiment, and is therefore not known exactly.
*/
public static final Unit UNIFIED_ATOMIC_MASS = addUnit(
new TransformedUnit(KILOGRAM, MultiplyConverter.of(1.660538782E-27)), "Unified atomic mass", "u",
true);
// CODATA 2006 - http://physics.nist.gov/cuu/Constants/codata.pdf
/**
* The dalton (Da) and the unified atomic mass unit (u) are alternative names (and symbols) for the same unit,
* equal to 1/12 times the mass of a free carbon 12 atom, at rest and in its ground state.
* The dalton is often combined with SI prefixes, for example to express the masses of large molecules in kilodaltons, kDa, or megadaltons, MDa,
* or to express the values of small mass differences of atoms or molecules in nanodaltons, nDa, or even picodaltons, pDa.
*/
public static final Unit DALTON = addUnit(
new TransformedUnit(UNIFIED_ATOMIC_MASS, AbstractConverter.IDENTITY), "Dalton", "Da");
/**
* A length unit accepted for use with SI units (standard name UA
).
* The astronomical unit is a unit of length. Its value is such that, when used
* to describe the motion of bodies in the solar system, the heliocentric
* gravitation constant is (0.017 202 098 95)2 ua3·d-2. The value must be
* obtained by experiment, and is therefore not known exactly.
*
* Originally conceived as the average of Earth's aphelion and perihelion,
* since 2012 it has been defined as exactly 149,597,870,700 metres,
* or about 150 million kilometres (93 million miles).
*
* @see Wikipedia: Astronomical unit
*/
public static final Unit ASTRONOMICAL_UNIT = addUnit(
new TransformedUnit(METRE, MultiplyConverter.of(149597871000.0)), "Astronomical Unit", "UA");
////////////
// Area //
////////////
/**
* An angle unit accepted for use with SI units (standard name ha
).
*/
public static final Unit HECTARE = addUnit(
new TransformedUnit(SQUARE_METRE, MultiplyConverter.ofRational(10000, 1)), "Hectare", "ha");
/////////////////////////
// Amount of substance //
/////////////////////////
/**
* A unit of amount of substance equals to one atom (standard name
* atom
).
*/
public static final Unit ATOM = addUnit(MOLE.divide(AVOGADRO_CONSTANT_VALUE),
"Atom", "atom");
////////////
// Length //
////////////
/**
* A unit of length equal to 1E-10 m
(standard name
* Å
).
*
* @see Wikipedia:
* Ångström
* @deprecated Not supported with the SI anymore, will be moved to another module into ObsoleteUnits or similar
*/
public static final Unit ANGSTROM = addUnit(METRE.divide(10000000000L), "\u00C5ngstr\u00F6m", "\u00C5");
/**
* A unit of length equal to the distance that light travels in one year through
* a vacuum (standard name ly
).
* @deprecated Not supported with the SI anymore, will be moved to another module into ObsoleteUnits or similar
*/
public static final Unit LIGHT_YEAR = addUnit(METRE.multiply(9.460528405e15), "Light year", "ly");
/**
* A unit of length equal to the distance at which a star would appear to shift
* its position by one arcsecond over the course the time (about 3 months) in
* which the Earth moves a distance of {@link #ASTRONOMICAL_UNIT} in the
* direction perpendicular to the direction to the star (standard name
* pc
).
*
* @deprecated Not supported with the SI anymore, will be moved to another module into ObsoleteUnits or similar
*/
public static final Unit PARSEC = addUnit(METRE.multiply(30856770e9), "Parsec", "pc");
/**
* A unit of length equal to 1852.0 m
(standard name
* nmi
).
* @deprecated Not supported with the SI anymore, will be moved to another module into ObsoleteUnits or similar
*/
public static final Unit NAUTICAL_MILE = addUnit(METRE.multiply(1852), "Nautical mile", "nmi");
/**
* The Bohr radius (a0 or rBohr) is a physical constant, approximately equal to the most probable distance between the nucleus and the electron in a hydrogen atom in its ground state.
* It is named after Niels Bohr, due to its role in the Bohr model of an atom. Its value is 5.2917721067(12)×10−11 m.
*
* @see Wikipedia: Niels Bohr
* @deprecated Not supported with the SI anymore, will be moved to another module into ObsoleteUnits or similar
*/
public static final Unit BOHR_RADIUS = addUnit(METRE.multiply(5.291772106712E-11), "Bohr Radius", "a0");
////////////
// Time //
////////////
/**
* A unit of duration equal to the time required for a complete rotation of the
* earth in reference to any star or to the vernal equinox at the meridian,
* equal to 23 hours, 56 minutes, 4.09 seconds (standard name
* day_sidereal
).
* @deprecated Not supported with the SI anymore, will be moved to another module into ObsoleteUnits or similar
*/
public static final Unit
© 2015 - 2025 Weber Informatics LLC | Privacy Policy