public class Duration extends AbstractDoubleScalarRel<DurationUnit,Duration>
DoubleScalar<DurationUnit> value = new DoubleScalar<DurationUnit>(100.0, DurationUnit.SI);we can now write:
Duration value = new Duration(100.0, DurationUnit.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-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands.
All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2015-12-22 04:32:39 +0100 (Tue, 22 Dec 2015) $, @version $Revision: 180 $, by $Author: averbraeck $,
initial version Sep 1, 2015
| Modifier and Type | Field and Description |
|---|---|
static Duration |
NaN
constant with value NaN.
|
static Duration |
NEG_MAXVALUE
constant with value -MAX_VALUE.
|
static Duration |
NEGATIVE_INFINITY
constant with value NEGATIVE_INFINITY.
|
static Duration |
POS_MAXVALUE
constant with value MAX_VALUE.
|
static Duration |
POSITIVE_INFINITY
constant with value POSITIVE_INFINITY.
|
static Duration |
ZERO
constant with value zero.
|
si| Constructor and Description |
|---|
Duration(double value,
DurationUnit unit)
Construct Duration scalar.
|
Duration(Duration value)
Construct Duration scalar.
|
| Modifier and Type | Method and Description |
|---|---|
static Duration |
createSI(double value)
Construct Duration scalar.
|
Dimensionless |
divideBy(Duration v)
Calculate the division of Duration and Duration, which results in a Dimensionless scalar.
|
Time |
instantiateAbs(double value,
TimeUnit unit)
Construct a new Absolute Immutable DoubleScalar of the right type.
|
Duration |
instantiateRel(double value,
DurationUnit unit)
Construct a new Relative Immutable DoubleScalar of the right type.
|
static Duration |
interpolate(Duration zero,
Duration one,
double ratio)
Interpolate between two values.
|
static Duration |
max(Duration r1,
Duration r2)
Return the maximum value of two relative scalars.
|
static Duration |
max(Duration r1,
Duration r2,
Duration... rn)
Return the maximum value of more than two relative scalars.
|
static Duration |
min(Duration r1,
Duration r2)
Return the minimum value of two relative scalars.
|
static Duration |
min(Duration r1,
Duration r2,
Duration... rn)
Return the minimum value of more than two relative scalars.
|
Speed |
multiplyBy(Acceleration v)
Calculate the multiplication of Duration and Acceleration, which results in a Speed scalar.
|
ElectricalCharge |
multiplyBy(ElectricalCurrent v)
Calculate the multiplication of Duration and ElectricalCurrent, which results in a ElectricalCharge scalar.
|
Mass |
multiplyBy(FlowMass v)
Calculate the multiplication of Duration and FlowMass, which results in a Mass scalar.
|
Volume |
multiplyBy(FlowVolume v)
Calculate the multiplication of Duration and FlowVolume, which results in a Volume scalar.
|
Dimensionless |
multiplyBy(Frequency v)
Calculate the multiplication of Duration and Frequency, which results in a Dimensionless scalar.
|
Money |
multiplyBy(MoneyPerDuration v)
Calculate the multiplication of Duration and MoneyPerDuration, which results in a Money scalar.
|
Energy |
multiplyBy(Power v)
Calculate the multiplication of Duration and Power, which results in a Energy scalar.
|
Length |
multiplyBy(Speed v)
Calculate the multiplication of Duration and Speed, which results in a Length scalar.
|
Time |
plus(Time v)
Relative scalar plus Absolute scalar = Absolute scalar.
|
abs, ceil, divideBy, floor, minus, multiplyBy, neg, plus, rint, roundcompareTo, doubleValue, eq, eq0, equals, floatValue, ge, ge0, getInUnit, getInUnit, getSI, gt, gt0, hashCode, intValue, le, le0, longValue, lt, lt0, ne, ne0, toString, toString, toString, toStringexpressAsSIUnit, expressAsSpecifiedUnit, getUnit, isAbsolute, isRelative, setDisplayUnitbyteValue, shortValueclone, finalize, getClass, notify, notifyAll, wait, wait, waitDIV, MULT, POWpublic static final Duration ZERO
public static final Duration NaN
public static final Duration POSITIVE_INFINITY
public static final Duration NEGATIVE_INFINITY
public static final Duration POS_MAXVALUE
public static final Duration NEG_MAXVALUE
public Duration(double value,
DurationUnit unit)
value - double valueunit - unit for the double valuepublic Duration(Duration value)
value - Scalar from which to construct this instancepublic final Duration instantiateRel(double value, DurationUnit unit)
instantiateRel in class AbstractDoubleScalarRel<DurationUnit,Duration>value - the double valueunit - the unitpublic final Time instantiateAbs(double value, TimeUnit unit)
value - the double valueunit - the unitpublic static final Duration createSI(double value)
value - double value in SI unitspublic static Duration interpolate(Duration zero, Duration one, double ratio)
zero - the low valueone - the high valueratio - the ratio between 0 and 1, inclusivepublic final Time plus(Time v)
v - the value to addpublic static Duration max(Duration r1, Duration r2)
r1 - the first scalarr2 - the second scalarpublic static Duration max(Duration r1, Duration r2, Duration... rn)
r1 - the first scalarr2 - the second scalarrn - the other scalarspublic static Duration min(Duration r1, Duration r2)
r1 - the first scalarr2 - the second scalarpublic static Duration min(Duration r1, Duration r2, Duration... rn)
r1 - the first scalarr2 - the second scalarrn - the other scalarspublic final Dimensionless divideBy(Duration v)
v - Duration scalarpublic final Dimensionless multiplyBy(Frequency v)
v - Duration scalarpublic final ElectricalCharge multiplyBy(ElectricalCurrent v)
v - Duration scalarpublic final Mass multiplyBy(FlowMass v)
v - Duration scalarpublic final Volume multiplyBy(FlowVolume v)
v - Duration scalarpublic final Speed multiplyBy(Acceleration v)
v - Duration scalarpublic final Energy multiplyBy(Power v)
v - Duration scalarpublic final Length multiplyBy(Speed v)
v - Duration scalarpublic final Money multiplyBy(MoneyPerDuration v)
v - Duration scalarCopyright © 2015–2018 Delft University of Technology. All rights reserved.