public class Mass extends AbstractDoubleScalarRel<MassUnit,Mass>
DoubleScalar.Rel<MassUnit> value = new DoubleScalar.Rel<MassUnit>(100.0, MassUnit.SI);we can now write:
Mass value = new Mass(100.0, MassUnit.SI);The compiler will automatically recognize which units belong to which quantity, and whether the quantity type and the unit used are compatible.
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
$LastChangedDate: 2019-03-03 00:53:50 +0100 (Sun, 03 Mar 2019) $, @version $Revision: 349 $, by $Author: averbraeck $,
initial version Sep 5, 2015
Modifier and Type | Field and Description |
---|---|
static Mass |
NaN
constant with value NaN.
|
static Mass |
NEG_MAXVALUE
constant with value -MAX_VALUE.
|
static Mass |
NEGATIVE_INFINITY
constant with value NEGATIVE_INFINITY.
|
static Mass |
POS_MAXVALUE
constant with value MAX_VALUE.
|
static Mass |
POSITIVE_INFINITY
constant with value POSITIVE_INFINITY.
|
static Mass |
ZERO
constant with value zero.
|
si
NUMBER_PATTERN
Constructor and Description |
---|
Mass(double value,
MassUnit unit)
Construct Mass scalar.
|
Mass(Mass value)
Construct Mass scalar.
|
Modifier and Type | Method and Description |
---|---|
static Mass |
createSI(double value)
Construct Mass scalar.
|
Volume |
divideBy(Density v)
Calculate the division of Mass and Density, which results in a Volume scalar.
|
FlowMass |
divideBy(Duration v)
Calculate the division of Mass and Duration, which results in a FlowMass scalar.
|
Duration |
divideBy(FlowMass v)
Calculate the division of Mass and FlowMass, which results in a Duration scalar.
|
Dimensionless |
divideBy(Mass v)
Calculate the division of Mass and Mass, which results in a Dimensionless scalar.
|
Density |
divideBy(Volume v)
Calculate the division of Mass and Volume, which results in a Density scalar.
|
Mass |
instantiateRel(double value,
MassUnit unit)
Construct a new Relative Immutable DoubleScalar of the right type.
|
static Mass |
interpolate(Mass zero,
Mass one,
double ratio)
Interpolate between two values.
|
static Mass |
max(Mass r1,
Mass r2)
Return the maximum value of two relative scalars.
|
static Mass |
max(Mass r1,
Mass r2,
Mass... rn)
Return the maximum value of more than two relative scalars.
|
static Mass |
min(Mass r1,
Mass r2)
Return the minimum value of two relative scalars.
|
static Mass |
min(Mass r1,
Mass r2,
Mass... rn)
Return the minimum value of more than two relative scalars.
|
Force |
multiplyBy(Acceleration v)
Calculate the multiplication of Mass and Acceleration, which results in a Force scalar.
|
FlowMass |
multiplyBy(Frequency v)
Calculate the multiplication of Mass and Frequency, which results in a FlowMass scalar.
|
Money |
multiplyBy(MoneyPerMass v)
Calculate the multiplication of Mass and MoneyPerMass, which results in a Money scalar.
|
static Mass |
valueOf(String text)
Returns a Mass representation of a textual representation of a value with a unit.
|
abs, ceil, divideBy, floor, minus, multiplyBy, neg, plus, rint, round
compareTo, doubleValue, eq, eq0, equals, floatValue, ge, ge0, getInUnit, getInUnit, getSI, gt, gt0, hashCode, intValue, le, le0, longValue, lt, lt0, ne, ne0, toString, toString, toString, toString
expressAsSIUnit, expressAsSpecifiedUnit, getUnit, isAbsolute, isRelative, setDisplayUnit, stringOf, stringOfDefaultLocale, textualStringOf, textualStringOfDefaultLocale
byteValue, shortValue
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
DIV, MULT, POW
public static final Mass ZERO
public static final Mass NaN
public static final Mass POSITIVE_INFINITY
public static final Mass NEGATIVE_INFINITY
public static final Mass POS_MAXVALUE
public static final Mass NEG_MAXVALUE
public Mass(double value, MassUnit unit)
value
- double valueunit
- unit for the double valuepublic Mass(Mass value)
value
- Scalar from which to construct this instancepublic final Mass instantiateRel(double value, MassUnit unit)
instantiateRel
in class AbstractDoubleScalarRel<MassUnit,Mass>
value
- double; the double valueunit
- U; the unitpublic static final Mass createSI(double value)
value
- double value in SI unitspublic static Mass interpolate(Mass zero, Mass one, double ratio)
zero
- the low valueone
- the high valueratio
- the ratio between 0 and 1, inclusivepublic static Mass max(Mass r1, Mass r2)
r1
- the first scalarr2
- the second scalarpublic static Mass max(Mass r1, Mass r2, Mass... rn)
r1
- the first scalarr2
- the second scalarrn
- the other scalarspublic static Mass min(Mass r1, Mass r2)
r1
- the first scalarr2
- the second scalarpublic static Mass min(Mass r1, Mass r2, Mass... rn)
r1
- the first scalarr2
- the second scalarrn
- the other scalarspublic static Mass valueOf(String text) throws IllegalArgumentException
text
- String; the textual representation to parse into a MassIllegalArgumentException
- when the text cannot be parsedpublic final Dimensionless divideBy(Mass v)
v
- Mass scalarpublic final Duration divideBy(FlowMass v)
v
- Mass scalarpublic final FlowMass divideBy(Duration v)
v
- Mass scalarpublic final Force multiplyBy(Acceleration v)
v
- Mass scalarpublic final FlowMass multiplyBy(Frequency v)
v
- Mass scalarpublic final Volume divideBy(Density v)
v
- Mass scalarpublic final Density divideBy(Volume v)
v
- Mass scalarpublic final Money multiplyBy(MoneyPerMass v)
v
- Mass scalarCopyright © 2015–2019 Delft University of Technology. All rights reserved.