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
public final class IdentityScale extends LinearScale
A Scale for standard, e.g. SI, units. Values in these units need no conversion.
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static IdentityScale
SCALE
A ready-to-use instance of the standard scale (they are all the same...). -
Method Summary
Modifier and Type Method Description double
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.String
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)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)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
-