public class FloatPosition extends AbstractFloatScalarAbs<PositionUnit,FloatPosition,LengthUnit,FloatLength>
FloatScalar.Abs<PositionUnit> value = new FloatScalar.Abs<PositionUnit>(100.0, PositionUnit.SI);we can now write:
FloatPosition value = new FloatPosition(100.0, PositionUnit.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: 2017-01-30 14:23:11 +0100 (Mon, 30 Jan 2017) $, @version $Revision: 234 $, by $Author: averbraeck $,
initial version Sep 1, 2015
Modifier and Type | Field and Description |
---|---|
static FloatPosition |
ZERO
constant with value zero.
|
si
Constructor and Description |
---|
FloatPosition(double value,
PositionUnit unit)
Construct FloatPosition scalar using a double value.
|
FloatPosition(FloatPosition value)
Construct FloatPosition scalar.
|
FloatPosition(float value,
PositionUnit unit)
Construct FloatPosition scalar.
|
Modifier and Type | Method and Description |
---|---|
static FloatPosition |
createSI(float value)
Construct FloatPosition scalar.
|
FloatPosition |
instantiateAbs(float value,
PositionUnit unit)
Construct a new Absolute Immutable FloatScalar of the right type.
|
FloatLength |
instantiateRel(float value,
LengthUnit unit)
Construct a new Relative Immutable FloatScalar of the right type.
|
static FloatPosition |
interpolate(FloatPosition zero,
FloatPosition one,
float ratio)
Interpolate between two values.
|
static FloatPosition |
max(FloatPosition a1,
FloatPosition a2)
Return the maximum value of two absolute scalars.
|
static FloatPosition |
max(FloatPosition a1,
FloatPosition a2,
FloatPosition... an)
Return the maximum value of more than two absolute scalars.
|
static FloatPosition |
min(FloatPosition a1,
FloatPosition a2)
Return the minimum value of two absolute scalars.
|
static FloatPosition |
min(FloatPosition a1,
FloatPosition a2,
FloatPosition... 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 FloatPosition ZERO
public FloatPosition(float value, PositionUnit unit)
value
- float valueunit
- unit for the float valuepublic FloatPosition(double value, PositionUnit unit)
value
- double valueunit
- unit for the resulting float valuepublic FloatPosition(FloatPosition value)
value
- Scalar from which to construct this instancepublic final FloatPosition instantiateAbs(float value, PositionUnit unit)
instantiateAbs
in class AbstractFloatScalarAbs<PositionUnit,FloatPosition,LengthUnit,FloatLength>
value
- the float valueunit
- the unitpublic final FloatLength instantiateRel(float value, LengthUnit unit)
instantiateRel
in class AbstractFloatScalarAbs<PositionUnit,FloatPosition,LengthUnit,FloatLength>
value
- the float valueunit
- the unitpublic static final FloatPosition createSI(float value)
value
- float value in BASE unitspublic static FloatPosition interpolate(FloatPosition zero, FloatPosition one, float ratio)
zero
- the low valueone
- the high valueratio
- the ratio between 0 and 1, inclusivepublic static FloatPosition max(FloatPosition a1, FloatPosition a2)
a1
- the first scalara2
- the second scalarpublic static FloatPosition max(FloatPosition a1, FloatPosition a2, FloatPosition... an)
a1
- the first scalara2
- the second scalaran
- the other scalarspublic static FloatPosition min(FloatPosition a1, FloatPosition a2)
a1
- the first scalara2
- the second scalarpublic static FloatPosition min(FloatPosition a1, FloatPosition a2, FloatPosition... an)
a1
- the first scalara2
- the second scalaran
- the other scalarsCopyright © 2015–2018 Delft University of Technology. All rights reserved.