Unit
Unit of measurement that defines a quantity, such as grams, meters, or seconds.
This is the base class for units. Actual units (such as Grams and Meters) can be found in the Units class.
Units can be organized in a hierarchy where each unit has an optional parent unit. The parent chain is automatically traversed to find the base unit - the unit at the root of the hierarchy that has no parent. For example, in a time unit hierarchy:
Days has parent Hours
Hours has parent Minutes
Minutes has parent Seconds
Seconds has no parent (it is the base unit)
Conversions between units are automatically composed through the parent chain, so converting from Days to the base unit (Seconds) properly chains through Hours and Minutes.
Type Parameters
the self-referencing type parameter for type-safe unit operations
Inheritors
Properties
Functions
Checks if this unit is equivalent to another one. Equivalence is determined by both units having the same base type and treat the same base unit magnitude as the same magnitude in their own units, to within Measure.EQUIVALENCE_THRESHOLD.
Converts a value in terms of base units to a value in terms of this unit.
Checks if this unit is the base unit for its own system of measurement.
Creates a new immutable measurement of the given magnitude in terms of this unit's base unit. Implementations are strongly recommended to sharpen the return type to a unit-specific measurement implementation.
Converts a value in terms of this unit to a value in terms of the base unit.