Measure
A measure holds the magnitude and unit of some dimension, such as distance, time, or speed. Two measures with the same unit and magnitude are effectively equivalent objects.
Since
1.0.0-pre
Parameters
Inheritors
Functions
Gets the magnitude of this measure in terms of the base unit. If the unit is the base unit for its system of measure, then the value will be equivalent to magnitude.
Divides this measurement by another measure and performs some dimensional analysis to reduce the units.
Divides this measurement by some constant divisor and returns the result. This is equivalent to times(1 / divisor)
Checks if this measure is equivalent to another measure of the same unit.
Checks if this measure is near another measure of the same unit. Provide a variance threshold for use for a +/- scalar, such as 0.05 for +/- 5%.
Checks if this measure is near another measure of the same unit, with a specified tolerance of the same unit.
Creates a new mutable copy of this measure.
Creates a relational measure equivalent to this one per some other unit.
Creates a velocity measure by dividing this one by a time period measure.
Creates a velocity measure equivalent to this one per a unit of time.
Generates a new measure that is equal to this measure multiplied by another. Some dimensional analysis is performed to reduce the units down somewhat; for example, multiplying a Measure<Time>
by a Measure<Velocity<Distance>>
will return just a Measure<Distance>
instead of the naive Measure<Mult<Time, Velocity<Distance>>
. This is not guaranteed to perform perfect dimensional analysis.
Multiplies this measurement by some constant multiplier and returns the result. The magnitude of the result will be the base magnitude multiplied by the scalar value. If the measure uses a unit with a non-linear relation to its base unit (such as Fahrenheit for temperature), then the result will only be a multiple in terms of the base unit.
Returns a string representation of this measurement in a longhand form. The name of the backing unit is used, rather than its symbol, and the magnitude is represented in a full string, not scientific notation. (Very large values may be represented in scientific notation, however)
Returns a string representation of this measurement in a scientific shorthand form. The symbol of the backing unit is used, rather than the full name, and the magnitude is represented in scientific notation.
Returns a string representation of this measurement in the default form. The symbol of the backing unit is used, rather than the full name, and the magnitude is represented in full, not in scientific notation. (Very large values may be represented in scientific notation, however)
Negates this measure and returns the result.