public class FloatDuration extends AbstractFloatScalarRel<DurationUnit,FloatDuration>
FloatScalar.Rel<DurationUnit> value = new FloatScalar.Rel<DurationUnit>(100.0, DurationUnit.SI);we can now write:
FloatDuration value = new FloatDuration(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 FloatDuration |
NaN
constant with value NaN.
|
static FloatDuration |
NEG_MAXVALUE
constant with value -MAX_VALUE.
|
static FloatDuration |
NEGATIVE_INFINITY
constant with value NEGATIVE_INFINITY.
|
static FloatDuration |
POS_MAXVALUE
constant with value MAX_VALUE.
|
static FloatDuration |
POSITIVE_INFINITY
constant with value POSITIVE_INFINITY.
|
static FloatDuration |
ZERO
constant with value zero.
|
si
Constructor and Description |
---|
FloatDuration(double value,
DurationUnit unit)
Construct FloatDuration scalar using a double value.
|
FloatDuration(FloatDuration value)
Construct FloatDuration scalar.
|
FloatDuration(float value,
DurationUnit unit)
Construct FloatDuration scalar.
|
Modifier and Type | Method and Description |
---|---|
static FloatDuration |
createSI(float value)
Construct FloatDuration scalar.
|
FloatDimensionless |
divideBy(FloatDuration v)
Calculate the division of FloatDuration and FloatDuration, which results in a FloatDimensionless scalar.
|
FloatTime |
instantiateAbs(float value,
TimeUnit unit)
Construct a new Absolute Immutable FloatScalar of the right type.
|
FloatDuration |
instantiateRel(float value,
DurationUnit unit)
Construct a new Relative Immutable FloatScalar of the right type.
|
static FloatDuration |
interpolate(FloatDuration zero,
FloatDuration one,
float ratio)
Interpolate between two values.
|
static FloatDuration |
max(FloatDuration r1,
FloatDuration r2)
Return the maximum value of two relative scalars.
|
static FloatDuration |
max(FloatDuration r1,
FloatDuration r2,
FloatDuration... rn)
Return the maximum value of more than two relative scalars.
|
static FloatDuration |
min(FloatDuration r1,
FloatDuration r2)
Return the minimum value of two relative scalars.
|
static FloatDuration |
min(FloatDuration r1,
FloatDuration r2,
FloatDuration... rn)
Return the minimum value of more than two relative scalars.
|
FloatSpeed |
multiplyBy(FloatAcceleration v)
Calculate the multiplication of FloatDuration and FloatAcceleration, which results in a FloatSpeed scalar.
|
FloatElectricalCharge |
multiplyBy(FloatElectricalCurrent v)
Calculate the multiplication of FloatDuration and FloatElectricalCurrent, which results in a FloatElectricalCharge
scalar.
|
FloatMass |
multiplyBy(FloatFlowMass v)
Calculate the multiplication of FloatDuration and FloatFlowMass, which results in a FloatMass scalar.
|
FloatVolume |
multiplyBy(FloatFlowVolume v)
Calculate the multiplication of FloatDuration and FloatFlowVolume, which results in a FloatVolume scalar.
|
FloatDimensionless |
multiplyBy(FloatFrequency v)
Calculate the multiplication of FloatDuration and FloatFrequency, which results in a FloatDimensionless scalar.
|
FloatMoney |
multiplyBy(FloatMoneyPerDuration v)
Calculate the multiplication of FloatDuration and FloatMoneyPerDuration, which results in a FloatMoney scalar.
|
FloatEnergy |
multiplyBy(FloatPower v)
Calculate the multiplication of FloatDuration and FloatPower, which results in a FloatEnergy scalar.
|
FloatLength |
multiplyBy(FloatSpeed v)
Calculate the multiplication of FloatDuration and FloatSpeed, which results in a FloatLength scalar.
|
FloatTime |
plus(FloatTime v)
Relative scalar plus Absolute scalar = Absolute scalar.
|
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
byteValue, shortValue
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
DIV, MULT, POW
public static final FloatDuration ZERO
public static final FloatDuration NaN
public static final FloatDuration POSITIVE_INFINITY
public static final FloatDuration NEGATIVE_INFINITY
public static final FloatDuration POS_MAXVALUE
public static final FloatDuration NEG_MAXVALUE
public FloatDuration(float value, DurationUnit unit)
value
- float valueunit
- unit for the float valuepublic FloatDuration(FloatDuration value)
value
- Scalar from which to construct this instancepublic FloatDuration(double value, DurationUnit unit)
value
- double valueunit
- unit for the resulting float valuepublic final FloatDuration instantiateRel(float value, DurationUnit unit)
instantiateRel
in class AbstractFloatScalarRel<DurationUnit,FloatDuration>
value
- the float valueunit
- the unitpublic static final FloatDuration createSI(float value)
value
- float value in SI unitspublic final FloatTime instantiateAbs(float value, TimeUnit unit)
value
- the float valueunit
- the unitpublic static FloatDuration interpolate(FloatDuration zero, FloatDuration one, float ratio)
zero
- the low valueone
- the high valueratio
- the ratio between 0 and 1, inclusivepublic final FloatTime plus(FloatTime v)
v
- the value to addpublic static FloatDuration max(FloatDuration r1, FloatDuration r2)
r1
- the first scalarr2
- the second scalarpublic static FloatDuration max(FloatDuration r1, FloatDuration r2, FloatDuration... rn)
r1
- the first scalarr2
- the second scalarrn
- the other scalarspublic static FloatDuration min(FloatDuration r1, FloatDuration r2)
r1
- the first scalarr2
- the second scalarpublic static FloatDuration min(FloatDuration r1, FloatDuration r2, FloatDuration... rn)
r1
- the first scalarr2
- the second scalarrn
- the other scalarspublic final FloatDimensionless divideBy(FloatDuration v)
v
- FloatDuration scalarpublic final FloatDimensionless multiplyBy(FloatFrequency v)
v
- FloatDuration scalarpublic final FloatElectricalCharge multiplyBy(FloatElectricalCurrent v)
v
- FloatDuration scalarpublic final FloatMass multiplyBy(FloatFlowMass v)
v
- FloatDuration scalarpublic final FloatVolume multiplyBy(FloatFlowVolume v)
v
- FloatDuration scalarpublic final FloatSpeed multiplyBy(FloatAcceleration v)
v
- FloatDuration scalarpublic final FloatEnergy multiplyBy(FloatPower v)
v
- FloatDuration scalarpublic final FloatLength multiplyBy(FloatSpeed v)
v
- FloatDuration scalarpublic final FloatMoney multiplyBy(FloatMoneyPerDuration v)
v
- FloatDuration scalarCopyright © 2015–2018 Delft University of Technology. All rights reserved.