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., {@link LinearScale} for Length, Area, etc.
7    * {@link 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 on the identity scale.
18       * @param value the value expressed in this unit
19       * @return the value converted to its SI value
20       */
21      double toIdentityScale(double value);
22  
23      /**
24       * Convert a value from a base (SI) value on the identity scale 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 fromIdentityScale(double value);
29  
30      /**
31       * Return whether a scale is an 'identity' scale. For a linear scale, any scale with conversion factor 1 would be considered
32       * an identity scale.
33       * @return whether the scale is an 'identity' scale
34       */
35      boolean isIdentityScale();
36  
37  }