Package org.djunits.value.util
Class ValueUtil
java.lang.Object
org.djunits.value.util.ValueUtil
public final class ValueUtil extends Object
ValueUtil implements a couple of unit-related static methods.
Copyright (c) 2015-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
- Author:
- Alexander Verbraeck, Peter Knoppers
-
Field Summary
Fields Modifier and Type Field Description static Pattern
NUMBER_PATTERN
Number pattern regex to be used in valueOf() method. -
Method Summary
Modifier and Type Method Description static double
expressAsSIUnit(double value, Unit<?> unit)
Convert a value in a given unit into the equivalent in the standard SI unit.static double
expressAsUnit(double siValue, Unit<?> targetUnit)
Convert a value from the standard SI unit into a compatible unit.
-
Field Details
-
NUMBER_PATTERN
Number pattern regex to be used in valueOf() method.
-
-
Method Details
-
expressAsSIUnit
Convert a value in a given unit into the equivalent in the standard SI unit.- Parameters:
value
- double; the value to convert into the standard SI unitunit
- Unit<?>; the unit of the given value- Returns:
- double; the value in the standard SI unit
-
expressAsUnit
Convert a value from the standard SI unit into a compatible unit.- Parameters:
siValue
- double; the given value in the standard SI unittargetUnit
- Unit<?>; the unit to convert the value into- Returns:
- double; the value in the targetUnit
-