Interface Scale

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

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-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
  • 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.
    boolean isBaseSIScale()
    Return whether a scale is a 'standard' scale that would belong to an SI unit.
    double toStandardUnit​(double value)
    Convert a value to an SI value using this scale.
  • Method Details

    • toStandardUnit

      double toStandardUnit​(double value)
      Convert a value to an SI value using this scale.
      Parameters:
      value - double; the value to convert
      Returns:
      the corresponding SI value
    • fromStandardUnit

      double fromStandardUnit​(double value)
      Convert a value from an SI value to a value in the unit that uses this scale.
      Parameters:
      value - double; the value to convert
      Returns:
      the corresponding value in the given unit
    • isBaseSIScale

      boolean isBaseSIScale()
      Return whether a scale is a 'standard' scale that would belong to an SI unit. 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:
      boolean; whether the scale is a 'standard' scale that would belong to an SI unit.