U - the unit for transformation reasonspublic abstract class Unit<U extends Unit<U>> extends Object implements Serializable
Copyright (c) 2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
$LastChangedDate: 2015-10-04 20:48:33 +0200 (Sun, 04 Oct 2015) $, @version $Revision: 87 $, by $Author: averbraeck $, initial
version May 15, 2014
| Modifier | Constructor and Description |
|---|---|
protected |
Unit(String nameOrNameKey,
String abbreviationOrAbbreviationKey,
UnitSystem unitSystem,
boolean standardUnit)
Build a standard unit.
|
protected |
Unit(String nameOrNameKey,
String abbreviationOrAbbreviationKey,
UnitSystem unitSystem,
U referenceUnit,
double conversionFactorToReferenceUnit,
boolean standardUnit)
Build a unit with a conversion factor to another unit.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
String |
getAbbreviation() |
String |
getAbbreviationKey()
This method returns the abbreviation key, or null in case the abbreviation is hard coded.
|
Set<Unit<U>> |
getAllUnitsOfThisType()
Return a copy of the set of all defined units for this unit type.
|
double |
getConversionFactorToStandardUnit() |
String |
getName() |
String |
getNameKey()
This method returns the name key, or null in case the name is hard coded.
|
SICoefficients |
getSICoefficients() |
abstract String |
getSICoefficientsString() |
abstract U |
getStandardUnit() |
static <V extends Unit<V>> |
getUnits(Class<V> unitClass)
Return a set of defined units for a given unit type.
|
UnitSystem |
getUnitSystem() |
int |
hashCode() |
boolean |
isLocalizable()
Report if this unit support localization.
|
static SIUnit |
lookupOrCreateSIUnitWithSICoefficients(String normalizedSICoefficientsString) |
static Set<Unit<?>> |
lookupOrCreateUnitWithSICoefficients(String normalizedSICoefficientsString) |
static Set<Unit<?>> |
lookupUnitWithSICoefficients(String normalizedSICoefficientsString) |
String |
toString() |
protected Unit(String nameOrNameKey, String abbreviationOrAbbreviationKey, UnitSystem unitSystem, boolean standardUnit)
nameOrNameKey - if standardUnit: the key to the locale file for the long name of the unit, otherwise the name itselfabbreviationOrAbbreviationKey - if standardUnit: the key to the locale file for the abbreviation of the unit,
otherwise the abbreviation itselfunitSystem - the unit system, e.g. SI or ImperialstandardUnit - indicates whether it is a standard unit with a definition in the locale, or a user-defined unitprotected Unit(String nameOrNameKey, String abbreviationOrAbbreviationKey, UnitSystem unitSystem, U referenceUnit, double conversionFactorToReferenceUnit, boolean standardUnit)
nameOrNameKey - if standardUnit: the key to the locale file for the long name of the unit, otherwise the name itselfabbreviationOrAbbreviationKey - if standardUnit: the key to the locale file for the abbreviation of the unit,
otherwise the abbreviation itselfunitSystem - the unit system, e.g. SI or ImperialreferenceUnit - the unit to convert toconversionFactorToReferenceUnit - multiply a value in this unit by the factor to convert to the given reference unitstandardUnit - indicates whether it is a standard unit with a definition in the locale, or a user-defined unitpublic final boolean isLocalizable()
public static <V extends Unit<V>> Set<V> getUnits(Class<V> unitClass)
V - the unit type to use in this method.unitClass - the class for which the units are requested, e.g. ForceUnit.classpublic final Set<Unit<U>> getAllUnitsOfThisType()
public final String getName()
public final String getNameKey()
public final String getAbbreviation()
public final String getAbbreviationKey()
public final double getConversionFactorToStandardUnit()
public final UnitSystem getUnitSystem()
public abstract U getStandardUnit()
public abstract String getSICoefficientsString()
public final SICoefficients getSICoefficients()
public static Set<Unit<?>> lookupUnitWithSICoefficients(String normalizedSICoefficientsString)
normalizedSICoefficientsString - the normalized string (e.g., kg.m/s2) to look uppublic static Set<Unit<?>> lookupOrCreateUnitWithSICoefficients(String normalizedSICoefficientsString)
normalizedSICoefficientsString - the normalized string (e.g., kg.m/s2) to look uppublic static SIUnit lookupOrCreateSIUnitWithSICoefficients(String normalizedSICoefficientsString)
normalizedSICoefficientsString - the normalized string (e.g., kg.m/s2) to look upCopyright © 2015 Delft University of Technology. All rights reserved.