Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* International System of Units (SI)
* Copyright (c) 2005-2019, 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 JSR-385, 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 si.uom.SI.AVOGADRO_CONSTANT_VALUE;
import static si.uom.SI.ELEMENTARY_CHARGE_VALUE;
import static tec.uom.se.unit.MetricPrefix.CENTI;
import static tec.uom.se.unit.MetricPrefix.FEMTO;
import static tec.uom.se.unit.MetricPrefix.MEGA;
import static tec.uom.se.AbstractUnit.ONE;
import static tec.uom.se.unit.Units.*;
import javax.measure.Unit;
import javax.measure.quantity.*;
import si.uom.quantity.DynamicViscosity;
import si.uom.quantity.IonizingRadiation;
import si.uom.quantity.KinematicViscosity;
import si.uom.quantity.Level;
import si.uom.quantity.Luminance;
import si.uom.quantity.MagneticFieldStrength;
import tec.uom.se.AbstractConverter;
import tec.uom.se.AbstractSystemOfUnits;
import tec.uom.se.AbstractUnit;
import tec.uom.se.format.SimpleUnitFormat;
import tec.uom.se.function.LogConverter;
import tec.uom.se.function.MultiplyConverter;
import tec.uom.se.function.PiMultiplierConverter;
import tec.uom.se.function.RationalConverter;
import tec.uom.se.unit.ProductUnit;
import tec.uom.se.unit.TransformedUnit;
import tec.uom.se.unit.Units;
/**
*
* This class contains units that are not part of the International System of
* Units, that is, they are outside the SI, but are important and widely used.
*
*
*
* This class is not intended to be implemented by clients.
*
*
* @noimplement This class is not intended to be implemented by clients.
* @noextend This class is not intended to be extended by clients.
*
* @author Jean-Marie Dautelle
* @author Werner Keil
* @version 1.3, $Date: 2019-05-01$
*/
public final class NonSI extends AbstractSystemOfUnits {
private static final String SYSTEM_NAME = "Non-SI Units";
/**
* Holds the standard gravity constant: 9.80665 m/s² exact.
*/
private static final int STANDARD_GRAVITY_DIVIDEND = 980665;
private static final int STANDARD_GRAVITY_DIVISOR = 100000;
/**
* Holds the avoirdupois pound: 0.45359237 kg exact
*/
private static final int AVOIRDUPOIS_POUND_DIVIDEND = 45359237;
private static final int AVOIRDUPOIS_POUND_DIVISOR = 100000000;
private static final NonSI INSTANCE = new NonSI();
/////////////////////////////////////////////////////////////////
// Units outside the SI that are accepted for use with the SI. //
/////////////////////////////////////////////////////////////////
/**
* An angle unit accepted for use with SI units (standard name
* deg).
*/
public static final Unit DEGREE_ANGLE = addUnit(
new TransformedUnit(RADIAN, new PiMultiplierConverter().concatenate(new RationalConverter(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,
new PiMultiplierConverter().concatenate(new RationalConverter(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,
new PiMultiplierConverter().concatenate(new RationalConverter(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, new MultiplyConverter(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, new MultiplyConverter(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.
*/
public static final Unit ASTRONOMICAL_UNIT = addUnit(
new TransformedUnit(METRE, new MultiplyConverter(149597871000.0)), "Astronomical Unit", "UA");
// Best estimate source: http://maia.usno.navy.mil/NSFA/CBE.html
/**
* An angle unit accepted for use with SI units (standard name ha).
*/
public static final Unit HECTARE = addUnit(
new TransformedUnit(SQUARE_METRE, new RationalConverter(10000, 1)), "Hectare", "ha");
///////////////////
// Dimensionless //
///////////////////
/**
* A dimensionless unit equals to pi (standard name
* π).
*/
public static final Unit PI = addUnit(AbstractUnit.ONE.multiply(StrictMath.PI));
/////////////////////////
// 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));
////////////
// Length //
////////////
/**
* A unit of length equal to 1E-10 m (standard name
* Å).
*
* @see Wikipedia:
* Ångström
*/
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).
*/
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).
*/
public static final Unit PARSEC = addUnit(METRE.multiply(30856770e9));
/**
* A unit of length equal to 1852.0 m (standard name
* nmi).
*/
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.
*/
public static final Unit BOHR_RADIUS = addUnit(METRE.multiply(5.291772106712E-11), "Bohr Radius", "a0");
////////////
// Area //
////////////
/**
* A barn (symbol: b) is a unit of area equal to 10−28
* m2 (100 fm2)
*/
public static final Unit BARN = addUnit(new ProductUnit(FEMTO(METRE).pow(2)).multiply(100));
//////////////
// 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).
*/
public static final Unit