TemperatureChange class

Represents a change in temperature.

Because temperature scales are not zero-based (except for Kelvin), working with temperature numbers can be counter-intuitive. For example, what does it mean to "subtract 10 degrees Celcius from 10 degrees Celcius"? One might say the answer is 0 degrees Celcius, but one might also say the answer is "absolute zero" (-273.15 degrees Celcius). Depending on what you mean when you say "subtract 10 degrees Celcius", one of those two will be correct.

To resolve this ambiguity, the TemperatureChange class allows one to model differences in temperature (as opposed to "thermometer" temperatures). If you intend to say "it is 10 degrees Celcius colder than yesterday" then you want to use a Temperature alongside a TemperatureChange of 10 degrees Celcius as opposed to two Temperatures of 10 degrees Celcius.

Instances of this class may also represent the difference between two "thermometer" temperatures. For example, if I calculate the difference in temperature between today's weather and yesterday's weather, I would get a TemperatureChange whose value indicates the amount of difference between the two Temperatures. It would not make sense to say that the difference in temperature is the "thermometer" temperature of 10 degrees.

Inheritance

Constructors

TemperatureChange.infinite([MeasurementInterpreter<TemperatureChange> interpreter = kelvin])
Infinite temperature change.
const
TemperatureChange.negativeInfinite([MeasurementInterpreter<TemperatureChange> interpreter = kelvin])
Negative infinite temperature change.
const
TemperatureChange.sum(Iterable<TemperatureChange> parts, {Precision precision = Precision.max})
Constructs a TemperatureChange representing the sum of any number of other TemperatureChanges.
TemperatureChange.zero([MeasurementInterpreter<TemperatureChange> interpreter = kelvin])
No change in temperature.
const

Properties

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

Methods

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

Operators

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