
tec.units.ri.spi.US Maven / Gradle / Ivy
/**
* Unit-API - Units of Measurement API for Java
* Copyright (c) 2005-2014, 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.spi.SI.*;
import static tec.units.ri.spi.SIPrefix.MICRO;
import tec.units.ri.AbstractSystemOfUnits;
import tec.units.ri.AbstractUnit;
import tec.units.ri.function.RationalConverter;
import tec.units.ri.unit.ProductUnit;
import tec.units.ri.unit.TransformedUnit;
import javax.measure.Unit;
import javax.measure.quantity.Angle;
import javax.measure.quantity.Area;
import javax.measure.quantity.Information;
import javax.measure.quantity.Energy;
import javax.measure.quantity.Length;
import javax.measure.quantity.Mass;
import javax.measure.quantity.Power;
import javax.measure.quantity.Temperature;
import javax.measure.quantity.Time;
import javax.measure.quantity.Speed;
import javax.measure.quantity.Volume;
import javax.measure.spi.SystemOfUnits;
/**
*
* This class contains units from the United States customary system.
*
*
*
* @noextend This class is not intended to be extended by clients.
*
* @author Jean-Marie Dautelle
* @author Werner Keil
* @version 1.17, $Date: 2014-04-06 22:44:42 +0200 (So, 06 Apr 2014) $
* @see Wikipedia:
* United State Customary Units
*/
public final class US extends AbstractSystemOfUnits {
/**
* Default constructor (prevents this class from being instantiated).
*/
private US() {
}
/**
* Returns the unique instance of this class.
*
* @return the USCustomary instance.
*/
public static SystemOfUnits getInstance() {
return INSTANCE;
}
private static final US INSTANCE = new US();
// //////////
// Length //
// //////////
/**
* US name for {@link SI#METRE}.
*/
public static final Unit METER = METRE;
/**
* A unit of length equal to 0.3048 m
(standard name
* ft
).
*/
public static final Unit FOOT = addUnit(METER.multiply(3048)
.divide(10000));
/**
* A unit of length equal to 1200/3937 m
(standard name
* foot_survey_us
). See also: foot
*/
public static final Unit FOOT_SURVEY = addUnit(METER.multiply(1200)
.divide(3937));
/**
* A unit of length equal to 0.9144 m
(standard name
* yd
).
*/
public static final Unit YARD = addUnit(FOOT.multiply(3));
/**
* A unit of length equal to 0.0254 m
(standard name
* in
).
*/
public static final Unit INCH = addUnit(FOOT.divide(12));
/**
* A unit of length equal to 1609.344 m
(standard name
* mi
).
*/
public static final Unit MILE = addUnit(METER.multiply(1609344)
.divide(1000));
/**
* 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));
/**
* A unit of length equal to 1852.0 m
(standard name
* nmi
).
*/
public static final Unit NAUTICAL_MILE = addUnit(METER
.multiply(1852));
// ////////
// Mass //
// ////////
/**
* A unit of mass equal to 453.59237 grams
(avoirdupois pound,
* standard name lb
).
*/
public static final Unit POUND = addUnit(KILOGRAM.multiply(45359237)
.divide(100000000)); //, Messages.US_lb_name);
/**
* A unit of mass equal to 1 / 16 {@link #POUND}
(standard name
* oz
).
*/
public static final Unit OUNCE = addUnit(POUND.divide(16));
/**
* A unit of mass equal to 2000 {@link #POUND}
(short ton,
* standard name ton
).
*/
public static final Unit TON = addUnit(POUND.multiply(2000));
// ///////////////
// Temperature //
// ///////////////
/**
* A unit of temperature equal to 5/9 °K
(standard name
* °R
).
*/
public static final Unit RANKINE = addUnit(KELVIN.multiply(5)
.divide(9));
/**
* A unit of temperature equal to degree Rankine minus
* 459.67 °R
(standard name °F
).
*
* @see #RANKINE
*/
public static final Unit FAHRENHEIT = addUnit(RANKINE
.shift(459.67));
// /////////
// Angle //
// /////////
/**
* A unit of angle equal to a full circle or 2π
* {@link SI#RADIAN}
(standard name rev
).
*/
public static final Unit REVOLUTION = addUnit(RADIAN.multiply(2)
.multiply(Math.PI).asType(Angle.class));
/**
* A unit of angle equal to 1/360 {@link #REVOLUTION}
(standard
* name deg
).
*/
public static final Unit DEGREE_ANGLE = addUnit(REVOLUTION
.divide(360));
/**
* A unit of angle equal to 1/60 {@link #DEGREE_ANGLE}
* (standard name '
).
*/
public static final Unit MINUTE_ANGLE = addUnit(DEGREE_ANGLE
.divide(60));
/**
* A unit of angle equal to 1/60 {@link #MINUTE_ANGLE}
* (standard name "
).
*/
public static final Unit SECOND_ANGLE = addUnit(MINUTE_ANGLE
.divide(60));
/**
* A unit of angle equal to 0.01 {@link SI#RADIAN}
(standard
* name centiradian
).
*/
public static final Unit CENTIRADIAN = addUnit(RADIAN.divide(100));
/**
* A unit of angle measure equal to 1/400 {@link #REVOLUTION}
* (standard name grade
).
*/
public static final Unit GRADE = addUnit(REVOLUTION.divide(400));
// ////////////
// TimeUnit //
// ////////////
/**
* A unit of time equal to 60 s
(standard name min
* ).
*/
public static final Unit