View Javadoc
1   package org.djunits.value.vfloat.matrix;
2   
3   import org.djunits.unit.AbsoluteLinearUnit;
4   import org.djunits.unit.Unit;
5   import org.djunits.value.MathFunctionsAbs;
6   import org.djunits.value.MathFunctionsRel;
7   import org.djunits.value.StorageType;
8   import org.djunits.value.ValueException;
9   import org.djunits.value.vfloat.FloatMathFunctions;
10  import org.djunits.value.vfloat.scalar.FloatScalar;
11  
12  /**
13   * MutableFloatMatrix.
14   * <p>
15   * This file was generated by the djunits value classes generator, 26 jun, 2015
16   * <p>
17   * Copyright (c) 2015-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
18   * BSD-style license. See <a href="http://djunits.org/docs/license.html">DJUNITS License</a>.
19   * <p>
20   * $LastChangedDate: 2018-01-28 03:17:44 +0100 (Sun, 28 Jan 2018) $, @version $Revision: 256 $, by $Author: averbraeck $,
21   * initial version 26 jun, 2015 <br>
22   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
23   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
24   */
25  public abstract class MutableFloatMatrix
26  {
27      /**
28       * ABSOLUTE implementation of MutableFloatVector.
29       * @param <AU> Absolute unit
30       * @param <RU> Relative unit
31       */
32      public static class Abs<AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>> extends
33              AbstractMutableFloatMatrixAbs<AU, RU, FloatMatrix.Abs<AU, RU>, FloatMatrix.Rel<RU>, MutableFloatMatrix.Abs<AU, RU>,
34                      FloatScalar.Abs<AU, RU>>
35              implements MathFunctionsAbs<MutableFloatMatrix.Abs<AU, RU>>, FloatMathFunctions<MutableFloatMatrix.Abs<AU, RU>>
36      {
37          /**  */
38          private static final long serialVersionUID = 20151003L;
39  
40          /**
41           * Construct a new Absolute Mutable FloatMatrix.
42           * @param values float[][]; the values of the entries in the new Absolute Mutable FloatMatrix
43           * @param unit AU; the unit of the new Absolute Mutable FloatMatrix
44           * @param storageType the data type to use (e.g., DENSE or SPARSE)
45           * @throws ValueException when values is null
46           */
47          public Abs(final float[][] values, final AU unit, final StorageType storageType) throws ValueException
48          {
49              super(values, unit, storageType);
50          }
51  
52          /**
53           * Construct a new Absolute Mutable FloatMatrix.
54           * @param values FloatScalar.Abs&lt;U&gt;[][]; the values of the entries in the new Absolute Mutable FloatMatrix
55           * @param storageType the data type to use (e.g., DENSE or SPARSE)
56           * @throws ValueException when values has zero entries
57           */
58          public Abs(final FloatScalar.Abs<AU, RU>[][] values, final StorageType storageType) throws ValueException
59          {
60              super(values, storageType);
61          }
62  
63          /**
64           * Construct a new Absolute Mutable FloatMatrix.
65           * @param data an internal data object
66           * @param unit the unit
67           */
68          Abs(final FloatMatrixData data, final AU unit)
69          {
70              super(data, unit);
71          }
72  
73          /** {@inheritDoc} */
74          @Override
75          @SuppressWarnings("designforextension")
76          public MutableFloatMatrix.Abs<AU, RU> toDense()
77          {
78              return this.data.isDense() ? this : instantiateMutableType(this.data.toDense(), getUnit());
79          }
80  
81          /** {@inheritDoc} */
82          @Override
83          @SuppressWarnings("designforextension")
84          public MutableFloatMatrix.Abs<AU, RU> toSparse()
85          {
86              return this.data.isSparse() ? this : instantiateMutableType(this.data.toSparse(), getUnit());
87          }
88  
89          /** {@inheritDoc} */
90          @Override
91          protected final FloatMatrix.Abs<AU, RU> instantiateTypeAbs(final FloatMatrixData dmd, final AU unit)
92          {
93              return new FloatMatrix.Abs<AU, RU>(dmd, unit);
94          }
95  
96          /** {@inheritDoc} */
97          @Override
98          protected final FloatMatrix.Rel<RU> instantiateTypeRel(final FloatMatrixData dmd, final RU unit)
99          {
100             return new FloatMatrix.Rel<RU>(dmd, unit);
101         }
102 
103         /** {@inheritDoc} */
104         @Override
105         protected final MutableFloatMatrix.Abs<AU, RU> instantiateMutableType(final FloatMatrixData dmd, final AU unit)
106         {
107             return new MutableFloatMatrix.Abs<AU, RU>(dmd, unit);
108         }
109 
110         /** {@inheritDoc} */
111         @Override
112         protected final FloatScalar.Abs<AU, RU> instantiateScalar(final float value, final AU unit)
113         {
114             return new FloatScalar.Abs<AU, RU>(value, unit);
115         }
116     }
117 
118     /**
119      * RELATIVE implementation of MutableFloatMatrix.
120      * @param <U> Unit the unit for which this Matrix will be created
121      */
122     public static class Rel<U extends Unit<U>>
123             extends AbstractMutableFloatMatrixRel<U, FloatMatrix.Rel<U>, MutableFloatMatrix.Rel<U>, FloatScalar.Rel<U>>
124             implements MathFunctionsRel<MutableFloatMatrix.Rel<U>>, FloatMathFunctions<MutableFloatMatrix.Rel<U>>
125     {
126         /**  */
127         private static final long serialVersionUID = 20151003L;
128 
129         /**
130          * Construct a new Relative Mutable FloatMatrix.
131          * @param values float[][]; the values of the entries in the new Relative Mutable FloatMatrix
132          * @param unit U; the unit of the new Relative Mutable FloatMatrix
133          * @param storageType the data type to use (e.g., DENSE or SPARSE)
134          * @throws ValueException when values is null
135          */
136         public Rel(final float[][] values, final U unit, final StorageType storageType) throws ValueException
137         {
138             super(values, unit, storageType);
139         }
140 
141         /**
142          * Construct a new Relative Mutable FloatMatrix.
143          * @param values FloatScalar.Abs&lt;U&gt;[][]; the values of the entries in the new Relative Mutable FloatMatrix
144          * @param storageType the data type to use (e.g., DENSE or SPARSE)
145          * @throws ValueException when values has zero entries
146          */
147         public Rel(final FloatScalar.Rel<U>[][] values, final StorageType storageType) throws ValueException
148         {
149             super(values, storageType);
150         }
151 
152         /**
153          * Construct a new Relative Mutable FloatMatrix.
154          * @param data an internal data object
155          * @param unit the unit
156          */
157         Rel(final FloatMatrixData data, final U unit)
158         {
159             super(data, unit);
160         }
161 
162         /** {@inheritDoc} */
163         @Override
164         @SuppressWarnings("designforextension")
165         public MutableFloatMatrix.Rel<U> toDense()
166         {
167             return this.data.isDense() ? this : new MutableFloatMatrix.Rel<U>(this.data.toDense(), getUnit());
168         }
169 
170         /** {@inheritDoc} */
171         @Override
172         @SuppressWarnings("designforextension")
173         public MutableFloatMatrix.Rel<U> toSparse()
174         {
175             return this.data.isSparse() ? this : new MutableFloatMatrix.Rel<U>(this.data.toSparse(), getUnit());
176         }
177 
178         /** {@inheritDoc} */
179         @Override
180         protected final FloatMatrix.Rel<U> instantiateType(final FloatMatrixData dmd, final U unit)
181         {
182             return new FloatMatrix.Rel<U>(dmd, unit);
183         }
184 
185         /** {@inheritDoc} */
186         @Override
187         protected final MutableFloatMatrix.Rel<U> instantiateMutableType(final FloatMatrixData dmd, final U unit)
188         {
189             return new MutableFloatMatrix.Rel<U>(dmd, unit);
190         }
191 
192         /** {@inheritDoc} */
193         @Override
194         protected final FloatScalar.Rel<U> instantiateScalar(final float value, final U unit)
195         {
196             return new FloatScalar.Rel<U>(value, unit);
197         }
198     }
199 }