DimensionfulQuantity Type

Represents a quantity, consisting of a numeric value, the corresponding unit and, optionally, a SI prefix for the unit. Please note that two DimensionfulQuantity instances are considered equal only if (i) the units are equal, (ii) the prefixes are equal, and (iii) the values are equal. If you want to compare the SI values, please compare the DimensionfulQuantity.AsValueInSIUnits values.

Constructors

Constructor Description

DimensionfulQuantity(value)

Full Usage: DimensionfulQuantity(value)

Parameters:
    value : float - Value.

Creates a dimensionless quantity with the provided value.

value : float

Value.

DimensionfulQuantity(value, unit)

Full Usage: DimensionfulQuantity(value, unit)

Parameters:
    value : float - The value of the created quantity.
    unit : IUnit - The unit of the created quantity.

Creates a quantity with the provided value in the given unit.

value : float

The value of the created quantity.

unit : IUnit

The unit of the created quantity.

DimensionfulQuantity(value, prefix, unit)

Full Usage: DimensionfulQuantity(value, prefix, unit)

Parameters:
    value : float - The value of the created quantity.
    prefix : SIPrefix - The prefix of the unit.
    unit : IUnit - The unit of the created quantity.

Creates a quantity with the provided value in the given prefixed unit.

value : float

The value of the created quantity.

prefix : SIPrefix

The prefix of the unit.

unit : IUnit

The unit of the created quantity.

DimensionfulQuantity(value, prefixedUnit)

Full Usage: DimensionfulQuantity(value, prefixedUnit)

Parameters:
    value : float - The value of the created quantity.
    prefixedUnit : IPrefixedUnit - The prefixed unit of the created quanity.

Creates a quantity with the provided value in the given prefixed unit.

value : float

The value of the created quantity.

prefixedUnit : IPrefixedUnit

The prefixed unit of the created quanity.

Instance members

Instance member Description

this.AsQuantityIn

Full Usage: this.AsQuantityIn

Parameters:
    unit : IUnit - The unit to convert the quantity to.

Returns: DimensionfulQuantity New instance of a quantity in the provided unit (without prefix).

Converts this quantity to another quantity in the provided unit (without prefix).

unit : IUnit

The unit to convert the quantity to.

Returns: DimensionfulQuantity

New instance of a quantity in the provided unit (without prefix).

this.AsQuantityIn

Full Usage: this.AsQuantityIn

Parameters:
    prefix : SIPrefix - The prefix of the unit to convert the quantity to.
    unit : IUnit - The unit to convert the quantity to.

Returns: DimensionfulQuantity New instance of a quantity in the provided unit with the provided prefix.

Converts this quantity to another quantity in the provided unit, with the provided prefix.

prefix : SIPrefix

The prefix of the unit to convert the quantity to.

unit : IUnit

The unit to convert the quantity to.

Returns: DimensionfulQuantity

New instance of a quantity in the provided unit with the provided prefix.

this.AsQuantityIn

Full Usage: this.AsQuantityIn

Parameters:
    prefixedUnit : IPrefixedUnit - The prefixed unit to convert the quantity to.

Returns: DimensionfulQuantity New instance of a quantity in the provided prefixed unit.

Converts this quantity to another quantity in the provided prefixed unit.

prefixedUnit : IPrefixedUnit

The prefixed unit to convert the quantity to.

Returns: DimensionfulQuantity

New instance of a quantity in the provided prefixed unit.

this.AsQuantityInSIUnits

Full Usage: this.AsQuantityInSIUnits

Returns: DimensionfulQuantity

Gets this quantity in SI units (without prefix).

Returns: DimensionfulQuantity

this.AsValueIn

Full Usage: this.AsValueIn

Parameters:
    unit : IUnit - The unit in which to get the numerical value of this quantity.

Returns: float Numerical value of this quantity in the provided unit (without prefix).

Converts this quantity to its numerical value in the given unit (without prefix).

unit : IUnit

The unit in which to get the numerical value of this quantity.

Returns: float

Numerical value of this quantity in the provided unit (without prefix).

this.AsValueIn

Full Usage: this.AsValueIn

Parameters:
    prefix : SIPrefix - The prefix of the unit in which to get the numerical value of this quantity.
    unit : IUnit - The unit in which to get the numerical value of this quantity.

Returns: float Numerical value of this quantity in the provided unit with the provided prefix.

Converts this quantity to its numerical value in the given unit, with the given prefix.

prefix : SIPrefix

The prefix of the unit in which to get the numerical value of this quantity.

unit : IUnit

The unit in which to get the numerical value of this quantity.

Returns: float

Numerical value of this quantity in the provided unit with the provided prefix.

this.AsValueIn

Full Usage: this.AsValueIn

Parameters:
    prefixedUnit : IPrefixedUnit - The prefixed unit in which to get the numerical value of this quantity.

Returns: float Numerical value of this quantity in the provided unit with the provided prefix.

Converts this quantity to its numerical value in the given unit, with the given prefix.

prefixedUnit : IPrefixedUnit

The prefixed unit in which to get the numerical value of this quantity.

Returns: float

Numerical value of this quantity in the provided unit with the provided prefix.

this.AsValueInSIUnits

Full Usage: this.AsValueInSIUnits

Returns: float

Converts this quantity to its numerical value in SI units (without prefix).

Returns: float

this.CompareTo

Full Usage: this.CompareTo

Parameters:
Returns: int The value is 1, if this quantity is greater than the other quantity; 0 if both quantities are equal, and -1 if this quantity is less than the other quantity.
Modifiers: abstract

Compares this quanitity to another quantity.

other : DimensionfulQuantity

The other quantity to compare with.

Returns: int

The value is 1, if this quantity is greater than the other quantity; 0 if both quantities are equal, and -1 if this quantity is less than the other quantity.

this.Equals

Full Usage: this.Equals

Parameters:
    obj : obj

Returns: bool
Modifiers: abstract

obj : obj
Returns: bool

this.GetHashCode

Full Usage: this.GetHashCode

Returns: int
Modifiers: abstract

Returns: int

this.HasBiasedUnit

Full Usage: this.HasBiasedUnit

Returns: bool

Gets a value indicating whether this instance has a biased unit (i.e. a unit implementing IBiasedUnit.

Returns: bool

this.IsEmpty

Full Usage: this.IsEmpty

Returns: bool

Gets a value indicating whether this instance is empty. It is empty if no unit has been associated so far with this instance.

Returns: bool

this.IsEqualInValuePrefixUnit

Full Usage: this.IsEqualInValuePrefixUnit

Parameters:
Returns: bool Returns true if a is equal in all three components(value, prefix, unit) to this quantity; otherwise, false.

Determines whether this instance is equal to another quanity in all three components (value, prefix and unit). This is not a comparison for the physical equality of the quantities.

a : DimensionfulQuantity

Quantity to compare.

Returns: bool

Returns true if a is equal in all three components(value, prefix, unit) to this quantity; otherwise, false.

this.Prefix

Full Usage: this.Prefix

Returns: SIPrefix

Gets the SI prefix of this quantity.

Returns: SIPrefix

this.PrefixedUnit

Full Usage: this.PrefixedUnit

Returns: PrefixedUnit

Gets the prefixed unit of this quantity.

Returns: PrefixedUnit

this.ToString

Full Usage: this.ToString

Returns: string
Modifiers: abstract

Returns: string

this.ToString

Full Usage: this.ToString

Parameters:
Returns: string
Modifiers: abstract

format : string
formatProvider : IFormatProvider
Returns: string

this.TreatedAsUnbiasedDifference

Full Usage: this.TreatedAsUnbiasedDifference

Returns: DimensionfulQuantity

Gets the quantity as treated as unbiased difference value. If the unit of this quantity is not biased, the return value is exactly this quantity. But if the unit is biased, the return value is the difference of this quantity and the same quantity with zero value. Example: 20 °C will transform to 20 K, because 20°C - 0 °C = 20 K.

Returns: DimensionfulQuantity

this.Unit

Full Usage: this.Unit

Returns: IUnit

Gets the unit of this quantity.

Returns: IUnit

this.Value

Full Usage: this.Value

Returns: float

Gets the numeric value of this quantity in the context of prefix and unit.

Returns: float

this.WithNewValue

Full Usage: this.WithNewValue

Parameters:
    value : float - New numeric value.

Returns: DimensionfulQuantity A new quantity with the provided value and the same prefix and unit as this quantity.

Creates an instance with a new value, and with the same prefix and unit as this quantity.

value : float

New numeric value.

Returns: DimensionfulQuantity

A new quantity with the provided value and the same prefix and unit as this quantity.

Static members

Static member Description

a * b

Full Usage: a * b

Parameters:
Returns: DimensionfulQuantity

a : DimensionfulQuantity
b : DimensionfulQuantity
Returns: DimensionfulQuantity

a * b

Full Usage: a * b

Parameters:
Returns: DimensionfulQuantity

a : DimensionfulQuantity
b : float
Returns: DimensionfulQuantity

a * b

Full Usage: a * b

Parameters:
Returns: DimensionfulQuantity

a : float
b : DimensionfulQuantity
Returns: DimensionfulQuantity

a + b

Full Usage: a + b

Parameters:
Returns: DimensionfulQuantity

a : DimensionfulQuantity
b : DimensionfulQuantity
Returns: DimensionfulQuantity

a - b

Full Usage: a - b

Parameters:
Returns: DimensionfulQuantity The result of the operator.

Implements the subtraction operator. Here, the intended operation is ambiguous if we subtract a biased unit and an unbiased unit. The result can be treated either as biased or unbiased. For example: 20°C minus 20 Kelvin. The result is either 293.15 K - 20 K = 273.15 K or 20°C - 20 K = 0 °C (biased). Although the same, this results in difficulties if subsequently rates are calculated from this result. Because of that, the decision was made to treat the result as unbiased value.

a : DimensionfulQuantity

a.

b : DimensionfulQuantity

The b.

Returns: DimensionfulQuantity

The result of the operator.

ArithmeticException Try to subtract two incompatible units or Can not execute subtraction of unbiased unit minus biased unit
NotImplementedException

a / b

Full Usage: a / b

Parameters:
Returns: DimensionfulQuantity

a : DimensionfulQuantity
b : DimensionfulQuantity
Returns: DimensionfulQuantity

a / b

Full Usage: a / b

Parameters:
Returns: DimensionfulQuantity

a : DimensionfulQuantity
b : float
Returns: DimensionfulQuantity

a / b

Full Usage: a / b

Parameters:
Returns: DimensionfulQuantity

a : float
b : DimensionfulQuantity
Returns: DimensionfulQuantity

a < b

Full Usage: a < b

Parameters:
Returns: bool

a : DimensionfulQuantity
b : DimensionfulQuantity
Returns: bool

a <= b

Full Usage: a <= b

Parameters:
Returns: bool

a : DimensionfulQuantity
b : DimensionfulQuantity
Returns: bool

a <> b

Full Usage: a <> b

Parameters:
Returns: bool

a : DimensionfulQuantity
b : DimensionfulQuantity
Returns: bool

a = b

Full Usage: a = b

Parameters:
Returns: bool

a : DimensionfulQuantity
b : DimensionfulQuantity
Returns: bool

a > b

Full Usage: a > b

Parameters:
Returns: bool

a : DimensionfulQuantity
b : DimensionfulQuantity
Returns: bool

a >= b

Full Usage: a >= b

Parameters:
Returns: bool

a : DimensionfulQuantity
b : DimensionfulQuantity
Returns: bool

~-a

Full Usage: ~-a

Parameters:
Returns: DimensionfulQuantity

a : DimensionfulQuantity
Returns: DimensionfulQuantity

DimensionfulQuantity.Abs(a)

Full Usage: DimensionfulQuantity.Abs(a)

Parameters:
Returns: DimensionfulQuantity

a : DimensionfulQuantity
Returns: DimensionfulQuantity

DimensionfulQuantity.Empty

Full Usage: DimensionfulQuantity.Empty

Returns: DimensionfulQuantity

Gets an empty, i.e. uninitialized, quantity.

Returns: DimensionfulQuantity

DimensionfulQuantity.Max(a, b)

Full Usage: DimensionfulQuantity.Max(a, b)

Parameters:
Returns: DimensionfulQuantity

a : DimensionfulQuantity
b : DimensionfulQuantity
Returns: DimensionfulQuantity

DimensionfulQuantity.Min(a, b)

Full Usage: DimensionfulQuantity.Min(a, b)

Parameters:
Returns: DimensionfulQuantity

a : DimensionfulQuantity
b : DimensionfulQuantity
Returns: DimensionfulQuantity

DimensionfulQuantity.RoundUpOrDown(a, b)

Full Usage: DimensionfulQuantity.RoundUpOrDown(a, b)

Parameters:
Returns: DimensionfulQuantity

a : DimensionfulQuantity
b : DimensionfulQuantity
Returns: DimensionfulQuantity