View Javadoc
1   package org.djunits.unit.scale;
2   
3   import java.io.Serializable;
4   
5   /**
6    * Scales for unit conversion, offers functions to and from SI units. E.g., LinearScale for Length, Area, etc. LinearOffsetScale
7    * for Temperature. PercentScale for Angle. LogarithmicScale for Sound, GradeScale for percentual angle.
8    * <p>
9    * Copyright (c) 2013-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
10   * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>.
11   * @author Alexander Verbraeck
12   * @author Peter Knoppers
13   */
14  public interface Scale extends Serializable
15  {
16      /**
17       * Convert a value expressed in this unit to its base (SI) value.
18       * @param value the value expressed in this unit
19       * @return the value converted to its SI value
20       */
21      double toBaseValue(double value);
22  
23      /**
24       * Convert a value from a base (SI) value to a value in the unit that uses this scale.
25       * @param value the value to convert
26       * @return the corresponding value in the given unit
27       */
28      double fromBaseValue(double value);
29  
30      /**
31       * Return whether a scale is a 'standard' scale. For a linear scale, any scale with conversion factor 1 would be considered
32       * standard. For an offset scale, it would be considered standard if the offset is 0 and the conversion factor is 1.
33       * @return whether the scale is a 'standard' scale
34       */
35      boolean isBaseScale();
36  
37  }