public final class DoubleScalarUtil extends Object
Copyright (c) 2013-2017 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Method and Description |
---|---|
static <U extends Unit<U>,S extends AbstractDoubleScalar<U,S>> |
instantiate(double value,
U unit)
Instantiate the DoubleScalar based on its unit.
|
static <S extends AbstractDoubleScalar<?,S>> |
instantiateAnonymous(double value,
Unit<?> unit)
Instantiate the DoubleScalar based on its unit.
|
static <S extends AbstractDoubleScalar<?,S>> |
instantiateAnonymousSI(double si,
Unit<?> displayUnit)
Instantiate the DoubleScalar based on its unit.
|
static <U extends Unit<U>,S extends AbstractDoubleScalar<U,S>> |
instantiateSI(double si,
U displayUnit)
Instantiate the DoubleScalar based on its unit.
|
public static <U extends Unit<U>,S extends AbstractDoubleScalar<U,S>> S instantiate(double value, U unit)
U
- the unitS
- the return typevalue
- the valueunit
- the unit in which the value is expressedpublic static <S extends AbstractDoubleScalar<?,S>> S instantiateAnonymous(double value, Unit<?> unit)
MoneyPerLengthUnit mlu = new MoneyPerLengthUnit(MoneyUnit.USD, LengthUnit.METER, "$/m", "$/m"); MoneyPerArea mpa = DoubleScalarUtil.instantiateAnonymous(10.0, mlu);
S
- the return typevalue
- the valueunit
- the unit in which the value is expressedpublic static <U extends Unit<U>,S extends AbstractDoubleScalar<U,S>> S instantiateSI(double si, U displayUnit)
U
- the unitS
- the return typesi
- the value in SI unitsdisplayUnit
- the unit in which the value is expressedpublic static <S extends AbstractDoubleScalar<?,S>> S instantiateAnonymousSI(double si, Unit<?> displayUnit)
MoneyPerLengthUnit mlu = new MoneyPerLengthUnit(MoneyUnit.USD, LengthUnit.METER, "$/m", "$/m"); MoneyPerArea mpa = DoubleScalarUtil.instantiateAnonymousSI(10.0, mlu);
S
- the return typesi
- the value in SI unitsdisplayUnit
- the unit in which the value is expressedCopyright © 2015–2018 Delft University of Technology. All rights reserved.