public class Position extends AbstractDoubleScalarAbs<PositionUnit,Position,LengthUnit,Length>
DoubleScalar.Abs<PositionUnit> value = new DoubleScalar.Abs<PositionUnit>(100.0, PositionUnit.SI);we can now write:
Position value = new Position(100.0, PositionUnit.BASE);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 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 Position |
ZERO
constant with value zero.
|
si
Constructor and Description |
---|
Position(double value,
PositionUnit unit)
Construct Position scalar.
|
Position(Position value)
Construct Position scalar.
|
Modifier and Type | Method and Description |
---|---|
static Position |
createSI(double value)
Construct %TypeAbsl% scalar.
|
Position |
instantiateAbs(double value,
PositionUnit unit)
Construct a new Absolute Immutable DoubleScalar of the right type.
|
Length |
instantiateRel(double value,
LengthUnit unit)
Construct a new Relative Immutable DoubleScalar of the right type.
|
static Position |
interpolate(Position zero,
Position one,
double ratio)
Interpolate between two values.
|
static Position |
max(Position a1,
Position a2)
Return the maximum value of two absolute scalars.
|
static Position |
max(Position a1,
Position a2,
Position... an)
Return the maximum value of more than two absolute scalars.
|
static Position |
min(Position a1,
Position a2)
Return the minimum value of two absolute scalars.
|
static Position |
min(Position a1,
Position a2,
Position... an)
Return the minimum value of more than two absolute scalars.
|
ceil, divideBy, floor, minus, minus, multiplyBy, 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 Position ZERO
public Position(double value, PositionUnit unit)
value
- double; double valueunit
- PositionUnit; unit for the double valuepublic Position(Position value)
value
- Position; Scalar from which to construct this instancepublic final Position instantiateAbs(double value, PositionUnit unit)
instantiateAbs
in class AbstractDoubleScalarAbs<PositionUnit,Position,LengthUnit,Length>
value
- double; the double valueunit
- AU; the unitpublic final Length instantiateRel(double value, LengthUnit unit)
instantiateRel
in class AbstractDoubleScalarAbs<PositionUnit,Position,LengthUnit,Length>
value
- double; the double valueunit
- RU; the unitpublic static final Position createSI(double value)
value
- double; double value in SI unitspublic static Position interpolate(Position zero, Position one, double ratio)
zero
- Position; the low valueone
- Position; the high valueratio
- double; the ratio between 0 and 1, inclusivepublic static Position max(Position a1, Position a2)
a1
- Position; the first scalara2
- Position; the second scalarpublic static Position max(Position a1, Position a2, Position... an)
a1
- Position; the first scalara2
- Position; the second scalaran
- Position...; the other scalarspublic static Position min(Position a1, Position a2)
a1
- Position; the first scalara2
- Position; the second scalarpublic static Position min(Position a1, Position a2, Position... an)
a1
- Position; the first scalara2
- Position; the second scalaran
- Position...; the other scalarsCopyright © 2015–2019 Delft University of Technology. All rights reserved.