View Javadoc
1   package org.djunits.value;
2   
3   import org.djunits.unit.AbsoluteLinearUnit;
4   import org.djunits.unit.Unit;
5   
6   /**
7    * Absolute values are quantities that are measured from some agreed upon reference point. Absolute types always have an
8    * associated Relative type, indicated by the interface AbsWithRel. Values are Absolute when the sum of two values makes no
9    * sense, but the difference does (but results in a Relative).
10   * <p>
11   * Copyright (c) 2015-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
12   * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>.
13   * </p>
14   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
15   * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a>
16   * @param <AU> the absolute unit type
17   * @param <A> the absolute value type
18   * @param <RU> the relative unit type
19   * @param <R> the relative value type
20   */
21  public interface Absolute<AU extends AbsoluteLinearUnit<AU, RU>, A extends Absolute<AU, A, RU, R>, RU extends Unit<RU>,
22          R extends RelWithAbs<AU, A, RU, R>>
23  {
24      /**
25       * Add a Relative value to this Absolute value. A new value is returned due to immutability.
26       * @param rel R; R the right operand
27       * @return A; the sum of this value and the operand
28       */
29      A plus(R rel);
30  
31      /**
32       * Subtract a Relative value from this Absolute value. A new value is returned due to immutability.
33       * @param rel R; R the right operand
34       * @return A; the subtraction of this value and the operand
35       */
36      A minus(R rel);
37  
38      /**
39       * Subtract an Absolute value from this Absolute value, resulting in a Relative value. A new value is returned due to
40       * immutability.
41       * @param abs A; A the right operand
42       * @return R; the subtraction of this value and the operand
43       */
44      R minus(A abs);
45  }