Measurement<T extends Measurement<T>> class abstract

Base class for any type of measurement.

Implemented types
Implementers

Constructors

Measurement(double si, Precision precision, [MeasurementInterpreter<T>? interpreter])
Constructs a basic measurement.
const
Measurement.infinite([MeasurementInterpreter<T>? interpreter])
An infinite measurement.
const
Measurement.negativeInfinite([MeasurementInterpreter<T>? interpreter])
A negative infinite measurement.
const
Measurement.sum(Iterable<T> parts, Precision precision)
Constructs a measurement representing the sum of other measurements.
Measurement.zero([MeasurementInterpreter<T>? interpreter])
A measurement of zero.
const

Properties

defaultInterpreter MeasurementInterpreter<T>?
The default unit for this measurement.
final
defaultValue double
Returns the default measurement value (i.e. the measurement as interpreted by the default MeasurementInterpreter.
no setter
hashCode int
The hash code for this object.
no setteroverride
isFinite bool
Returns true if this measurement is finite.
no setter
isInfinite bool
Returns true if this measurement is infinite (either positive or negative).
no setter
isNaN bool
Returns true if this measurement cannot be expressed as a number.
no setter
isNegative bool
Returns true if this measurement is negative.
no setter
precision int
Returns the number of digits of precision this measurement has.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
si double
The SI value this measurement is based on.
final

Methods

acceptVisitor(MeasurementVisitor visitor) → void
Accept a visitor object for double-dispatch.
by<V extends Measurement<V>>(Measurement<V> other) DerivedMeasurement<Measurement<T>, Measurement<V>>
Creates a derived unit that is the multiplication of this measurement with another.
compareMagnitude(T other) double
Returns the difference in magnitude between this and another measurement.
compareTo(T other) int
Compares this object to another object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
per<V extends Measurement<V>>(Measurement<V> other) DerivedMeasurement<Measurement<T>, Measurement<V>>
Creates a derived measurement that is the division of this measurement with another.
toString() String
A string representation of this object.
override
withDefaultUnit(MeasurementInterpreter<T> interpreter) → T
Creates a new measurement equivalent to this one but with a different default unit.
withPrecision(Precision precision) → T
Creates an equivalent measurement with the specified precision.

Operators

operator *(double multiplier) → T
Returns a measurement equivalent to a multiple of this.
operator +(T other) → T
Returns a measurement equivalent to the sum of two others.
operator -(T other) → T
Returns a measurement equivalent to the difference between two others.
operator /(double divisor) → T
Returns a measurement equivalent to a fraction of this.
operator <(T other) bool
Returns true if this is less than the other measurement.
operator <=(T other) bool
Returns true if this is less than or equal to the other measurement.
operator ==(Object other) bool
The equality operator.
override
operator >(T other) bool
Returns true if this is greater than the other measurement.
operator >=(T other) bool
Returns true if this is greater than or equal to the other measurement.
operator unary-() → T
Returns a measurement representing the opposite of this.
operator ~/(T other) int
Returns the truncating division result of this and another measurement.