U
- the unit for transformation reasonspublic abstract class Unit<U extends Unit<U>> extends Object implements Serializable
Copyright (c) 2014 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Constructor and Description |
---|
Unit(String nameKey,
String abbreviationKey,
UnitSystem unitSystem,
boolean safe)
Build a standard unit.
|
Unit(String nameKey,
String abbreviationKey,
UnitSystem unitSystem,
U referenceUnit,
double conversionFactorToReferenceUnit,
boolean safe)
Build a unit with a conversion factor to another unit.
|
Modifier and Type | Method and Description |
---|---|
String |
getAbbreviation() |
String |
getAbbreviationKey() |
Set<Unit<U>> |
getAllUnitsOfThisType()
Return a copy of the set of all defined units for this unit type.
|
double |
getConversionFactorToStandardUnit() |
String |
getName() |
String |
getNameKey() |
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() |
static SIUnit |
lookupOrCreateSIUnitWithSICoefficients(String normalizedSICoefficientsString) |
static Set<Unit<?>> |
lookupOrCreateUnitWithSICoefficients(String normalizedSICoefficientsString) |
static Set<Unit<?>> |
lookupUnitWithSICoefficients(String normalizedSICoefficientsString) |
String |
toString() |
public Unit(String nameKey, String abbreviationKey, UnitSystem unitSystem, boolean safe)
nameKey
- the key to the locale file for the long name of the unitabbreviationKey
- the key to the locale file for the abbreviation of the unitunitSystem
- the unit system, e.g. SI or Imperialsafe
- Boolean; if true, a UnitException is silently ignored; if false a UnitException is an Errorpublic Unit(String nameKey, String abbreviationKey, UnitSystem unitSystem, U referenceUnit, double conversionFactorToReferenceUnit, boolean safe)
nameKey
- the key to the locale file for the long name of the unitabbreviationKey
- the key to the locale file for the abbreviation of the unitunitSystem
- 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 unitsafe
- Boolean; if true, a UnitException is silently ignored; if false a UnitException is an Errorpublic 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 © 2014–2015 Delft University of Technology. All rights reserved.