Interface Scale

All Superinterfaces:
Serializable
All Known Implementing Classes:
GradeScale, IdentityScale, LinearScale

public interface Scale extends Serializable
Scales for unit conversion, offers functions to and from SI units. E.g., LinearScale for Length, Area, etc. LinearOffsetScale for Temperature. PercentScale for Angle. LogarithmicScale for Sound, GradeScale for percentual angle.

Copyright (c) 2013-2026 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
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    fromBaseValue(double value)
    Convert a value from a base (SI) value to a value in the unit that uses this scale.
    boolean
    Return whether a scale is a 'standard' scale.
    double
    toBaseValue(double value)
    Convert a value expressed in this unit to its base (SI) value.
  • Method Details

    • toBaseValue

      double toBaseValue(double value)
      Convert a value expressed in this unit to its base (SI) value.
      Parameters:
      value - the value expressed in this unit
      Returns:
      the value converted to its SI value
    • fromBaseValue

      double fromBaseValue(double value)
      Convert a value from a base (SI) value to a value in the unit that uses this scale.
      Parameters:
      value - the value to convert
      Returns:
      the corresponding value in the given unit
    • isBaseScale

      boolean isBaseScale()
      Return whether a scale is a 'standard' scale. For a linear scale, any scale with conversion factor 1 would be considered standard. For an offset scale, it would be considered standard if the offset is 0 and the conversion factor is 1.
      Returns:
      whether the scale is a 'standard' scale