AU
- the absolute unit.RU
- the corresponding 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-2019 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 name,
String abbreviation,
UnitSystem unitSystem,
double scaleFactorToReferenceUnit,
double offsetToReferenceUnit,
RU relativeUnit)
Build a user-defined unit with an absolute linear scale and create the fields for that unit.
|
protected |
AbsoluteLinearUnit(String abbreviationKey,
UnitSystem unitSystem,
double scaleFactorToReferenceUnit,
double offsetToReferenceUnit,
RU relativeUnit)
Build a standard unit with an absolute linear scale and create the fields for that unit.
|
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, getDefaultLocaleAbbreviation, getDefaultLocaleName, getDefaultLocaleTextualRepresentation, getDefaultLocaleTextualRepresentations, getDefaultTextualRepresentation, getName, getSICoefficients, getSICoefficientsString, getStandardUnit, getTextualRepresentations, getUnits, getUnitSystem, isBaseSIUnit, isLocalizable, lookupOrCreateSIUnitWithSICoefficients, lookupOrCreateUnitWithSICoefficients, lookupUnitWithSICoefficients, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getScaleFactor
protected AbsoluteLinearUnit(String abbreviationKey, UnitSystem unitSystem, double scaleFactorToReferenceUnit, double offsetToReferenceUnit, RU relativeUnit)
abbreviationKey
- String; the key to the locale file for the abbreviation of the unitunitSystem
- the unit system, e.g. SI or Imperial; often the unit system for an absolute unit will be OTHERscaleFactorToReferenceUnit
- double; multiply by this number to convert to the standard unitoffsetToReferenceUnit
- double; the offset to the reference unit to add to convert to the standard (e.g., BASE) unitrelativeUnit
- RU; the corresponding relative unit belonging to this absolute unitprotected AbsoluteLinearUnit(String name, String abbreviation, UnitSystem unitSystem, double scaleFactorToReferenceUnit, double offsetToReferenceUnit, RU relativeUnit)
name
- String; the unit nameabbreviation
- String; the unit abbreviationunitSystem
- the unit system, e.g. SI or Imperial; often the unit system for an absolute unit will be OTHERscaleFactorToReferenceUnit
- double; multiply by this number to convert to the standard unitoffsetToReferenceUnit
- double; the offset to the reference unit to add to convert to the standard (e.g., BASE) unitrelativeUnit
- RU; 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
- Object; the object to compare withCopyright © 2015–2019 Delft University of Technology. All rights reserved.