public class Density extends AbstractDoubleScalarRel<DensityUnit,Density>
DoubleScalar.Rel<DensityUnit> value = new DoubleScalar.Rel<DensityUnit>(100.0, DensityUnit.SI);we can now write:
Density value = new Density(100.0, DensityUnit.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 Density |
NaN
constant with value NaN.
|
static Density |
NEG_MAXVALUE
constant with value -MAX_VALUE.
|
static Density |
NEGATIVE_INFINITY
constant with value NEGATIVE_INFINITY.
|
static Density |
POS_MAXVALUE
constant with value MAX_VALUE.
|
static Density |
POSITIVE_INFINITY
constant with value POSITIVE_INFINITY.
|
static Density |
ZERO
constant with value zero.
|
si
NUMBER_PATTERN
Constructor and Description |
---|
Density(Density value)
Construct Density scalar.
|
Density(double value,
DensityUnit unit)
Construct Density scalar.
|
Modifier and Type | Method and Description |
---|---|
static Density |
createSI(double value)
Construct Density scalar.
|
Dimensionless |
divideBy(Density v)
Calculate the division of Density and Density, which results in a Dimensionless scalar.
|
Density |
instantiateRel(double value,
DensityUnit unit)
Construct a new Relative Immutable DoubleScalar of the right type.
|
static Density |
interpolate(Density zero,
Density one,
double ratio)
Interpolate between two values.
|
static Density |
max(Density r1,
Density r2)
Return the maximum value of two relative scalars.
|
static Density |
max(Density r1,
Density r2,
Density... rn)
Return the maximum value of more than two relative scalars.
|
static Density |
min(Density r1,
Density r2)
Return the minimum value of two relative scalars.
|
static Density |
min(Density r1,
Density r2,
Density... rn)
Return the minimum value of more than two relative scalars.
|
Mass |
multiplyBy(Volume v)
Calculate the multiplication of Density and Volume, which results in a Mass scalar.
|
static Density |
valueOf(String text)
Returns a Density 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 Density ZERO
public static final Density NaN
public static final Density POSITIVE_INFINITY
public static final Density NEGATIVE_INFINITY
public static final Density POS_MAXVALUE
public static final Density NEG_MAXVALUE
public Density(double value, DensityUnit unit)
value
- double valueunit
- unit for the double valuepublic Density(Density value)
value
- Scalar from which to construct this instancepublic final Density instantiateRel(double value, DensityUnit unit)
instantiateRel
in class AbstractDoubleScalarRel<DensityUnit,Density>
value
- double; the double valueunit
- U; the unitpublic static final Density createSI(double value)
value
- double value in SI unitspublic static Density interpolate(Density zero, Density one, double ratio)
zero
- the low valueone
- the high valueratio
- the ratio between 0 and 1, inclusivepublic static Density max(Density r1, Density r2)
r1
- the first scalarr2
- the second scalarpublic static Density max(Density r1, Density r2, Density... rn)
r1
- the first scalarr2
- the second scalarrn
- the other scalarspublic static Density min(Density r1, Density r2)
r1
- the first scalarr2
- the second scalarpublic static Density min(Density r1, Density r2, Density... rn)
r1
- the first scalarr2
- the second scalarrn
- the other scalarspublic static Density valueOf(String text) throws IllegalArgumentException
text
- String; the textual representation to parse into a DensityIllegalArgumentException
- when the text cannot be parsedpublic final Dimensionless divideBy(Density v)
v
- Density scalarCopyright © 2015–2019 Delft University of Technology. All rights reserved.