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-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
10   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
11   * </p>
12   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
13   * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a>
14   */
15  public interface Scale extends Serializable
16  {
17      /**
18       * Convert a value to an SI value using this scale.
19       * @param value double; the value to convert
20       * @return the corresponding SI value
21       */
22      double toStandardUnit(double value);
23  
24      /**
25       * Convert a value from an SI value to a value in the unit that uses this scale.
26       * @param value double; the value to convert
27       * @return the corresponding value in the given unit
28       */
29      double fromStandardUnit(double value);
30  
31      /**
32       * Return whether a scale is a 'standard' scale that would belong to an SI unit. For a linear scale, any scale with
33       * conversion factor 1 would be considered standard. For an offset scale, it would be considered standard if the offset is 0
34       * and the conversion factor is 1.
35       * @return boolean; whether the scale is a 'standard' scale that would belong to an SI unit.
36       */
37      boolean isBaseSIScale();
38  
39  }