public class Duration extends TypedDoubleScalarRel<TimeUnit,Duration>
DoubleScalar<TimeUnit> value = new DoubleScalar<TimeUnit>(100.0, TimeUnit.SI);we can now write:
Duration value = new Duration(100.0, TimeUnit.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-2016 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
DoubleScalar.Abs<U extends Unit<U>>, DoubleScalar.Rel<U extends Unit<U>>| Modifier and Type | Field and Description |
|---|---|
static Duration |
ZERO
constant with value zero.
|
si| Constructor and Description |
|---|
Duration(double value,
TimeUnit unit)
Construct Duration scalar.
|
Duration(Duration value)
Construct Duration scalar.
|
| Modifier and Type | Method and Description |
|---|---|
Dimensionless |
divideBy(Duration v)
Calculate the division of Duration and Duration, which results in a Dimensionless scalar.
|
protected Time |
instantiateTypeAbs(double value,
TimeUnit unit)
Construct a new Absolute Immutable DoubleScalar of the right type.
|
protected Duration |
instantiateTypeRel(double value,
TimeUnit 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(MoneyPerTime v)
Calculate the multiplication of Duration and MoneyPerTime, 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.
|
Time |
toAbs()
Translate the relative scalar into an absolute scalar (e.g., before or after a multiplication or division).
|
abs, ceil, divideBy, floor, minus, multiplyBy, plus, rint, roundcompareTo, eq, ge, getSI, gt, le, lt, minus, ne, plusdivide, divide, doubleValue, equals, floatValue, getInUnit, getInUnit, hashCode, interpolate, interpolate, intValue, longValue, minus, minus, minus, multiply, multiply, plus, plus, plus, toString, toString, toString, toStringexpressAsSIUnit, expressAsSpecifiedUnit, getUnit, isAbsolute, isRelativebyteValue, shortValueclone, finalize, getClass, notify, notifyAll, wait, wait, waitDIV, MULT, POWpublic static final Duration ZERO
public Duration(double value,
TimeUnit unit)
value - double valueunit - unit for the double valuepublic Duration(Duration value)
value - Scalar from which to construct this instanceprotected final Duration instantiateTypeRel(double value, TimeUnit unit)
instantiateTypeRel in class TypedDoubleScalarRel<TimeUnit,Duration>value - the double valueunit - the unitprotected final Time instantiateTypeAbs(double value, TimeUnit unit)
value - the double valueunit - the unitpublic 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 final Time toAbs()
public 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(MoneyPerTime v)
v - Duration scalarCopyright © 2015–2016 Delft University of Technology. All rights reserved.