View Javadoc
1   package org.djunits.value.vfloat.scalar.base;
2   
3   import org.djunits.unit.AbsoluteLinearUnit;
4   import org.djunits.unit.Unit;
5   import org.djunits.value.base.Scalar;
6   
7   /**
8    * Float scalar functions.
9    * <p>
10   * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
11   * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>.
12   * </p>
13   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
14   * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a>
15   * @author <a href="https://www.transport.citg.tudelft.nl">Wouter Schakel</a>
16   * @param <U> the unit for which this is the interface
17   * @param <S> the scalar type belonging to the unit
18   */
19  public interface FloatScalarInterface<U extends Unit<U>, S extends FloatScalarInterface<U, S>> extends Scalar<U, S>
20  {
21      /**
22       * Retrieve the value in the underlying SI unit.
23       * @return float
24       */
25      float getSI();
26  
27      /**
28       * Retrieve the value in the original unit.
29       * @return float
30       */
31      float getInUnit();
32  
33      /**
34       * Retrieve the value converted into some specified unit.
35       * @param targetUnit U; the unit to convert the value into
36       * @return float
37       */
38      float getInUnit(U targetUnit);
39  
40      /**
41       * Methods for Relative FloatScalar.
42       * <p>
43       * Copyright (c) 2019-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
44       * <br>
45       * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>.
46       * <p>
47       * @author <a href="https://www.tudelft.nl/averbraeck" target="_blank">Alexander Verbraeck</a>
48       * @param <U> the unit
49       * @param <R> the relative scalar
50       */
51      public interface Rel<U extends Unit<U>, R extends FloatScalarInterface.Rel<U, R>>
52              extends FloatScalarInterface<U, R>, Scalar.Rel<U, R>
53      {
54          /**
55           * Construct a new Relative Immutable FloatScalar of the right type. Each extending class must implement this method.
56           * @param value float; the float value
57           * @param unit U; the unit
58           * @return R a new relative instance of the FloatScalar of the right type
59           */
60          R instantiateRel(float value, U unit);
61      }
62  
63      /**
64       * Additional methods for Relative Scalar that has a corresponding Absolute Scalar. An example is the relative scalar Length
65       * that has a corresponding absolute scalar Position.
66       * <p>
67       * Copyright (c) 2019-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
68       * <br>
69       * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>.
70       * <p>
71       * @author <a href="https://www.tudelft.nl/averbraeck" target="_blank">Alexander Verbraeck</a>
72       * @param <AU> the absolute unit belonging to the absoluteunit
73       * @param <A> the absolute scalar belonging to the relative scalar
74       * @param <RU> the absolute unit belonging to the relative unit
75       * @param <R> the relative scalar belonging to the absolute scalar
76       */
77      public interface RelWithAbs<AU extends AbsoluteLinearUnit<AU, RU>, A extends FloatScalarInterface.Abs<AU, A, RU, R>,
78              RU extends Unit<RU>, R extends FloatScalarInterface.RelWithAbs<AU, A, RU, R>>
79              extends FloatScalarInterface<RU, R>, Scalar.RelWithAbs<AU, A, RU, R>
80      {
81          /**
82           * Construct a new Relative Immutable FloatScalar of the right type. Each extending class must implement this method.
83           * @param value float; the float value
84           * @param unit U; the unit
85           * @return R a new relative instance of the FloatScalar of the right type
86           */
87          R instantiateRel(float value, RU unit);
88  
89          /**
90           * Construct a new Absolute Immutable FloatScalar of the right type. Each extending class must implement this method.
91           * @param value float; the float value
92           * @param unit AU; the absolute unit
93           * @return A a new absolute instance of the FloatScalar of the right type
94           */
95          A instantiateAbs(float value, AU unit);
96      }
97  
98      /**
99       * Methods for Absolute Scalar.
100      * <p>
101      * Copyright (c) 2019-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
102      * <br>
103      * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>.
104      * <p>
105      * @author <a href="https://www.tudelft.nl/averbraeck" target="_blank">Alexander Verbraeck</a>
106      * @param <AU> the absolute unit belonging to the absoluteunit
107      * @param <A> the absolute scalar belonging to the relative scalar
108      * @param <RU> the absolute unit belonging to the relative unit
109      * @param <R> the relative scalar belonging to the absolute scalar
110      */
111     public interface Abs<AU extends AbsoluteLinearUnit<AU, RU>, A extends FloatScalarInterface.Abs<AU, A, RU, R>,
112             RU extends Unit<RU>, R extends FloatScalarInterface.RelWithAbs<AU, A, RU, R>>
113             extends FloatScalarInterface<AU, A>, Scalar.Abs<AU, A, RU, R>
114     {
115         /**
116          * Construct a new Relative Immutable FloatScalar of the right type. Each extending class must implement this method.
117          * @param value float; the float value
118          * @param unit U; the unit
119          * @return R a new relative instance of the FloatScalar of the right type
120          */
121         R instantiateRel(float value, RU unit);
122 
123         /**
124          * Construct a new Absolute Immutable FloatScalar of the right type. Each extending class must implement this method.
125          * @param value float; the float value
126          * @param unit AU; the absolute unit
127          * @return A a new absolute instance of the FloatScalar of the right type
128          */
129         A instantiateAbs(float value, AU unit);
130     }
131 
132 }