public class Time extends TypedDoubleScalarAbs<TimeUnit,Time,Duration>
DoubleScalar.Abs<TimeUnit> value = new DoubleScalar.Abs<TimeUnit>(100.0, TimeUnit.SI);we can now write:
Time value = new Time(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: 2016-05-28 14:25:52 +0200 (Sat, 28 May 2016) $, @version $Revision: 202 $, 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 Time |
ZERO
constant with value zero.
|
si| Constructor and Description |
|---|
Time(double value,
TimeUnit unit)
Construct Time scalar.
|
Time(Time value)
Construct Time scalar.
|
| Modifier and Type | Method and Description |
|---|---|
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 Time |
interpolate(Time zero,
Time one,
double ratio)
Interpolate between two values.
|
static Time |
max(Time a1,
Time a2)
Return the maximum value of two absolute scalars.
|
static Time |
max(Time a1,
Time a2,
Time... an)
Return the maximum value of more than two absolute scalars.
|
static Time |
min(Time a1,
Time a2)
Return the minimum value of two absolute scalars.
|
static Time |
min(Time a1,
Time a2,
Time... an)
Return the minimum value of more than two absolute scalars.
|
ceil, floor, minus, minus, plus, rint, round, toRelcompareTo, divideBy, eq, ge, getSI, gt, le, lt, minus, minus, multiplyBy, 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 Time ZERO
public Time(double value,
TimeUnit unit)
value - double valueunit - unit for the double valuepublic Time(Time value)
value - Scalar from which to construct this instanceprotected final Time instantiateTypeAbs(double value, TimeUnit unit)
instantiateTypeAbs in class TypedDoubleScalarAbs<TimeUnit,Time,Duration>value - the double valueunit - the unitprotected final Duration instantiateTypeRel(double value, TimeUnit unit)
instantiateTypeRel in class TypedDoubleScalarAbs<TimeUnit,Time,Duration>value - the double valueunit - the unitpublic static Time interpolate(Time zero, Time one, double ratio)
zero - the low valueone - the high valueratio - the ratio between 0 and 1, inclusivepublic static Time max(Time a1, Time a2)
a1 - the first scalara2 - the second scalarpublic static Time max(Time a1, Time a2, Time... an)
a1 - the first scalara2 - the second scalaran - the other scalarspublic static Time min(Time a1, Time a2)
a1 - the first scalara2 - the second scalarCopyright © 2015–2016 Delft University of Technology. All rights reserved.