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-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 Details

    • SCALE

      public static final IdentityScale 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 interface Scale
      Overrides:
      toStandardUnit in class LinearScale
      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 interface Scale
      Overrides:
      fromStandardUnit in class LinearScale
      Parameters:
      value - double; the value to convert
      Returns:
      the corresponding value in the given unit
    • toString

      public String toString()
      Overrides:
      toString in class LinearScale