View Javadoc
1   package org.djunits.value.vfloat.matrix;
2   
3   import org.djunits.unit.LengthUnit;
4   import org.djunits.value.StorageType;
5   import org.djunits.value.ValueException;
6   import org.djunits.value.vfloat.scalar.FloatLength;
7   
8   /**
9    * Mutable FloatLength Matrix.
10   * <p>
11   * Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
12   * BSD-style license. See <a href="http://djunits.org/docs/license.html">DJUNITS License</a>.
13   * <p>
14   * $LastChangedDate: 2015-09-29 14:14:28 +0200 (Tue, 29 Sep 2015) $, @version $Revision: 73 $, by $Author: pknoppers $, initial
15   * version Sep 5, 2015 <br>
16   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
17   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
18   */
19  public class MutableFloatLengthMatrix
20          extends AbstractMutableFloatMatrixRel<LengthUnit, FloatLengthMatrix, MutableFloatLengthMatrix, FloatLength>
21  {
22      /** */
23      private static final long serialVersionUID = 20151006L;
24  
25      /**
26       * Construct a new Relative Mutable FloatLengthMatrix.
27       * @param values float[][]; the values of the entries in the new Relative Mutable FloatLengthMatrix
28       * @param unit U; the unit of the new Relative Mutable FloatLengthMatrix
29       * @param storageType the data type to use (e.g., DENSE or SPARSE)
30       * @throws ValueException when values is null
31       */
32      public MutableFloatLengthMatrix(final float[][] values, final LengthUnit unit, final StorageType storageType)
33              throws ValueException
34      {
35          super(values, unit, storageType);
36      }
37  
38      /**
39       * Construct a new Relative Mutable FloatLengthMatrix.
40       * @param values FloatScalar.Rel&lt;U&gt;[][]; the values of the entries in the new Relative Mutable FloatLengthMatrix
41       * @param storageType the data type to use (e.g., DENSE or SPARSE)
42       * @throws ValueException when values has zero entries
43       */
44      public MutableFloatLengthMatrix(final FloatLength[][] values, final StorageType storageType) throws ValueException
45      {
46          super(values, storageType);
47      }
48  
49      /**
50       * Construct a new Relative Mutable FloatLengthMatrix.
51       * @param data an internal data object
52       * @param unit the unit
53       */
54      MutableFloatLengthMatrix(final FloatMatrixData data, final LengthUnit unit)
55      {
56          super(data, unit);
57      }
58  
59      /** {@inheritDoc} */
60      @Override
61      protected final FloatLengthMatrix instantiateType(final FloatMatrixData fmd, final LengthUnit unit)
62      {
63          return new FloatLengthMatrix(fmd, unit);
64      }
65  
66      /** {@inheritDoc} */
67      @Override
68      public final MutableFloatLengthMatrix toDense()
69      {
70          return this.data.isDense() ? this : instantiateMutableType(this.data.toDense(), getUnit());
71      }
72  
73      /** {@inheritDoc} */
74      @Override
75      public final MutableFloatLengthMatrix toSparse()
76      {
77          return this.data.isSparse() ? this : instantiateMutableType(this.data.toSparse(), getUnit());
78      }
79  
80      /** {@inheritDoc} */
81      @Override
82      protected final MutableFloatLengthMatrix instantiateMutableType(final FloatMatrixData fmd, final LengthUnit unit)
83      {
84          return new MutableFloatLengthMatrix(fmd, unit);
85      }
86  
87      /** {@inheritDoc} */
88      @Override
89      protected final FloatLength instantiateScalar(final float value, final LengthUnit unit)
90      {
91          return new FloatLength(value, unit);
92      }
93  
94  }