Package org.djunits.unit.scale
Class IdentityScale
java.lang.Object
org.djunits.unit.scale.LinearScale
org.djunits.unit.scale.IdentityScale
- All Implemented Interfaces:
Serializable
,Scale
A Scale for standard, e.g. SI, units. Values in these units need no conversion.
Copyright (c) 2013-2024 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
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final IdentityScale
A ready-to-use instance of the standard scale (they are all the same...). -
Method Summary
Modifier and TypeMethodDescriptiondouble
fromStandardUnit
(double value) Convert a value from an SI value to a value in the unit that uses this scale.double
toStandardUnit
(double value) Convert a value to an SI value using this scale.toString()
Methods inherited from class org.djunits.unit.scale.LinearScale
equals, getConversionFactorToStandardUnit, hashCode, isBaseSIScale
-
Field Details
-
SCALE
A ready-to-use instance of the standard scale (they are all the same...).
-
-
Method Details
-
toStandardUnit
public double toStandardUnit(double value) Description copied from interface:Scale
Convert a value to an SI value using this scale.- Specified by:
toStandardUnit
in interfaceScale
- Overrides:
toStandardUnit
in classLinearScale
- Parameters:
value
- double; the value to convert- Returns:
- the corresponding SI value
-
fromStandardUnit
public double fromStandardUnit(double value) Description copied from interface:Scale
Convert a value from an SI value to a value in the unit that uses this scale.- Specified by:
fromStandardUnit
in interfaceScale
- Overrides:
fromStandardUnit
in classLinearScale
- Parameters:
value
- double; the value to convert- Returns:
- the corresponding value in the given unit
-
toString
- Overrides:
toString
in classLinearScale
-