AU
- the absolute unit.RU
- the correcponding relative unitpublic abstract class AbsoluteLinearUnit<AU extends LinearUnit<AU>,RU extends Unit<RU>> extends LinearUnit<AU> implements AbsoluteUnit
An absolute unit is always a unit with an OffsetLinearScale. The offset defines how far away the origin of that absolute unit is compared to the base unit. The linear scale indicates in what default "steps" compared to the reference relative scale the absolute scale is used. For temperature, this is very clear. Degrees Celcius is shifted 273.15 compared to the origin of the Kelvin scale, and the linear unit is 1 (relatively, 1 Kelvin is one degree Celcius). For Degree Fahrenheit, the linear scale is 5/9, and the offset is 459.67. For Direction, North can be chosen as 0, and radians (SI) as the default angle. But one could also define a NORTH_DEGREES absolute direction unit, or a WEST_RADIANS one. Similar choices can be made for time and position.
Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
STANDARD_UNITS
Modifier | Constructor and Description |
---|---|
protected |
AbsoluteLinearUnit(String nameOrNameKey,
String abbreviationOrAbbreviationKey,
UnitSystem unitSystem,
double scaleFactorToReferenceUnit,
double offsetToReferenceUnit,
boolean standardUnit,
RU relativeUnit) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
boolean |
equalsIgnoreNaming(Object obj)
Test if two units are the same, except for the name and abbreviation.
|
double |
getOffset()
Return the offset to transform to the standard (reference) unit.
|
RU |
getRelativeUnit()
Return the corresponding relative unit that belongs to this absolute unit.
|
OffsetLinearScale |
getScale() |
int |
hashCode() |
getScaleFactor
generateHashCode, getAbbreviation, getAbbreviationKey, getAllUnitsOfThisType, getName, getNameKey, getSICoefficients, getSICoefficientsString, getStandardUnit, getUnits, getUnitSystem, isBaseSIUnit, isLocalizable, lookupOrCreateSIUnitWithSICoefficients, lookupOrCreateUnitWithSICoefficients, lookupUnitWithSICoefficients, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getScaleFactor
protected AbsoluteLinearUnit(String nameOrNameKey, String abbreviationOrAbbreviationKey, UnitSystem unitSystem, double scaleFactorToReferenceUnit, double offsetToReferenceUnit, boolean standardUnit, RU relativeUnit)
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 Imperial; often the unit system for an absolute unit will be OTHERscaleFactorToReferenceUnit
- multiply by this number to convert to the standard unitoffsetToReferenceUnit
- the offset to the reference unit to add to convert to the standard (e.g., BASE) unitstandardUnit
- indicates whether it is a standard unit with a definition in the locale, or a user-defined unitrelativeUnit
- the corresponding relative unit belonging to this absolute unitpublic final OffsetLinearScale getScale()
getScale
in class LinearUnit<AU extends LinearUnit<AU>>
public final double getOffset()
getOffset
in interface AbsoluteUnit
public final RU getRelativeUnit()
public int hashCode()
hashCode
in class LinearUnit<AU extends LinearUnit<AU>>
public boolean equals(Object obj)
equals
in class LinearUnit<AU extends LinearUnit<AU>>
public boolean equalsIgnoreNaming(Object obj)
equalsIgnoreNaming
in class LinearUnit<AU extends LinearUnit<AU>>
obj
- the object to compare withCopyright © 2015–2018 Delft University of Technology. All rights reserved.