Mass class
Represents the mass physical quantity (one of the seven base SI quantities), that determines the strength of a body's mutual gravitational attraction to other bodies. See the Wikipedia entry for Mass for more information.
Constructors
- Mass({dynamic kg, dynamic g, dynamic u, double uncert = 0.0})
-
Constructs a Mass with kilograms (
kg
), grams (g
) or unified atomic mass units (u
). Optionally specify a relative standard uncertainty. - Mass.constant(Number valueSI, {MassUnits? units, double uncert = 0.0})
-
Constructs a constant Mass.
const
- Mass.inUnits(dynamic value, MassUnits? units, [double uncert = 0.0])
-
Constructs a Mass based on the
value
and the conversion factor intrinsic to the passedunits
. - Mass.misc(dynamic conv)
- Constructs a instance without preferred units.
Properties
- arbitraryPrecision → bool
-
Whether or not this Quantity is represented using arbitrary precision.
no setterinherited
- cgs → Number
-
Returns the value of this quantity in alternative CGS
(or centimeter-gram-second) units. MKS (meter-kilogram-second) units are
preferred.
no setterinherited
- dimensions → Dimensions
-
Dimensions.
finalinherited
- hashCode → int
-
The hash code is based on the value and dimensions.
Uncertainty and preferred units are not considered.
no setterinherited
- isScalar → bool
-
Whether or not this Quantity has scalar dimensions, including having no angle or
solid angle dimensions.
no setterinherited
- isScalarSI → bool
-
Whether or not this Quantity has scalar dimensions in the strict
International System of Units (SI) sense, which allows non-zero angle and
solid angle dimensions.
no setterinherited
- mks → Number
-
Returns the value of this quantity in standard MKS (or meter-kilogram-second) units.
no setterinherited
- preferredUnits → Units?
-
Preferred units for display.
finalinherited
- relativeUncertainty → double
-
The relative standard uncertainty in this Quantity object's value.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- standardUncertainty → Quantity
-
Returns the standard uncertainty in this Quantity object's value as a typed
Quantity object.
no setterinherited
- valueSI → Number
-
The value of the quantity in the base units,
of the International System of Units (SI).
finalinherited
Methods
-
abs(
) → Quantity -
Returns the absolute value of this Quantity.
If the value of this Quantity is not negative it is returned directly.
inherited
-
calcExpandedUncertainty(
double k) → Quantity -
Returns the expanded uncertainty for coverage factor,
k
, in this Quantity's value as a typed Quantity object.inherited -
compareTo(
dynamic q2) → int -
Compares this Quantity to
q2
by comparing MKS values. The Quantities need not have the same dimensions.inherited -
inverse(
) → Quantity -
Determines the inverse of the quantity represented by this object,
creating and returning a Quantity object (which may have different
dimensions and therefore be of a different type). This object is not
modified.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
outputText(
StringBuffer buffer, {UncertaintyFormat uncertFormat = UncertaintyFormat.none, bool symbols = true, NumberFormat? numberFormat}) → void -
Appends a String representation of this Quantity to the
buffer
using the preferred units and number format. If no preferred units have been specified, then MKS units are used. Uncertainty in the value of the Quantity is optionally shown as a plus/minus value in the same units.inherited -
randomSample(
) → Quantity -
Randomly generates a Quantity from this Quantity's value and uncertainty.
The uncertainty is represented by a Normal (Gaussian) continuous
distribution.
inherited
-
sqrt(
) → Quantity -
Returns a Quantity that represents the square root of this Quantity,
in terms of both value and dimensions (for example, if this Quantity were an
Area of 16 square meters, a Length of 4 meters will be returned).
inherited
-
toEnergy(
) → Energy - Returns the Energy equivalent of this Mass using the famous E=mc^2 relationship.
-
toJson(
) → Map< String, dynamic> -
Support dart:convert stringify.
inherited
-
toString(
) → String -
Returns a String representation of this Quantity using the preferredUnits.
If no preferred units have been specified, then MKS units are used.
inherited
-
valueInUnits(
Units? units) → Number -
Gets the Quantity's value in the specified
units
. If units is null, the MKS value is returned. If not null,units
must have dimensions compatible with this Quantity or a DimensionsException will be thrown.inherited
Operators
-
operator *(
dynamic multiplier) → Quantity -
Returns the product of this quantity and
multiplier
, which is expected to be either a Quantity, num or Number object. All other types will cause a QuantityException to be thrown.inherited -
operator +(
dynamic addend) → Quantity -
Returns the sum of this Quantity and
addend
.inherited -
operator -(
dynamic subtrahend) → Quantity -
Returns the difference of this Quantity and
subtrahend
or (this - q2).inherited -
operator /(
dynamic divisor) → Quantity -
Returns the quotient of this quantity and
divisor
, including both value and dimensions.inherited -
operator <(
Quantity other) → bool -
Determines whether on not this Quantity is less than a specified Quantity by
comparing their MKS values. The two Quantities need not be of the same
type or dimensions.
inherited
-
operator <=(
Quantity other) → bool -
Determines whether on not this Quantity is less than or equal to a
specified Quantity by comparing their MKS values. The two Quantities
need not be of the same type or dimensions.
inherited
-
operator ==(
Object obj) → bool -
Returns true if this Quantity is equal to
obj
. Two Quantity objects are considered equal if their MKS values and dimensions are equal. Only values and dimensions are considered; other attributes such as uncertainty and preferred units are ignored.inherited -
operator >(
Quantity other) → bool -
Determines whether on not this Quantity is greater than a specified Quantity by
comparing their MKS values. The two Quantities need not be of the same
type or dimensions.
inherited
-
operator >=(
Quantity other) → bool -
Determines whether on not this Quantity is greater than or equal to a specified
Quantity by comparing their MKS values. The two Quantities need not be of
the same type or dimensions.
inherited
-
operator ^(
dynamic exponent) → Quantity -
Returns this Quantity raised to the power of
exponent
.inherited -
operator unary-(
) → Quantity -
The unary minus operator returns a Quantity whose value
is the negative of this Quantity's value.
inherited
Static Properties
- grams → MassUnits
-
Note: kilograms are the standard MKS unit for mass, but grams is used here
to generate the appropriate prefixes. Gram conversion value is set to 0.001
in order to generate the correct units.
final
- kilograms → MassUnits
-
The standard SI unit.
final
- metricTons → MassUnits
-
Accepted for use with the SI.
final
- tonnes → MassUnits
-
Accepted for use with the SI.
final
- unifiedAtomicMassUnits → MassUnits
-
Accepted for use with the SI.
final
Constants
- massDimensions → const Dimensions
- Dimensions for this type of quantity.