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-2022 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 PatternNUMBER_PATTERNNumber pattern regex to be used in valueOf() method.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doubleexpressAsSIUnit(double value, Unit<?> unit)Convert a value in a given unit into the equivalent in the standard SI unit.static doubleexpressAsUnit(double siValue, Unit<?> targetUnit)Convert a value from the standard SI unit into a compatible unit.
-
-
-
Field Detail
-
NUMBER_PATTERN
public static final Pattern NUMBER_PATTERN
Number pattern regex to be used in valueOf() method.
-
-
Method Detail
-
expressAsSIUnit
public static double expressAsSIUnit(double value, Unit<?> unit)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
public static double expressAsUnit(double siValue, Unit<?> targetUnit)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
-
-