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    * Immutable 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 FloatLengthMatrix
20          extends AbstractFloatMatrixRel<LengthUnit, FloatLengthMatrix, MutableFloatLengthMatrix, FloatLength>
21  {
22      /** */
23      private static final long serialVersionUID = 20151006L;
24  
25      /**
26       * Construct a new Relative Immutable FloatLengthMatrix.
27       * @param values float[][]; the values of the entries in the new Relative Immutable FloatLengthMatrix
28       * @param unit U; the unit of the new Relative Immutable FloatLengthMatrix
29       * @param storageType the data type to use (e.g., DENSE or SPARSE)
30       * @throws ValueException when values is null
31       */
32      public FloatLengthMatrix(final float[][] values, final LengthUnit unit, final StorageType storageType) throws ValueException
33      {
34          super(values, unit, storageType);
35      }
36  
37      /**
38       * Construct a new Relative Immutable FloatLengthMatrix.
39       * @param values FloatScalar.Rel&lt;U&gt;[][]; the values of the entries in the new Relative Immutable FloatLengthMatrix
40       * @param storageType the data type to use (e.g., DENSE or SPARSE)
41       * @throws ValueException when values has zero entries
42       */
43      public FloatLengthMatrix(final FloatLength[][] values, final StorageType storageType) throws ValueException
44      {
45          super(values, storageType);
46      }
47  
48      /**
49       * Construct a new Relative Immutable FloatLengthMatrix.
50       * @param data an internal data object
51       * @param unit the unit
52       */
53      FloatLengthMatrix(final FloatMatrixData data, final LengthUnit unit)
54      {
55          super(data, unit);
56      }
57  
58      /** {@inheritDoc} */
59      @Override
60      public final FloatLengthMatrix toDense()
61      {
62          return this.data.isDense() ? this : instantiateType(this.data.toDense(), getUnit());
63      }
64  
65      /** {@inheritDoc} */
66      @Override
67      public final FloatLengthMatrix toSparse()
68      {
69          return this.data.isSparse() ? this : instantiateType(this.data.toSparse(), getUnit());
70      }
71  
72      /** {@inheritDoc} */
73      @Override
74      protected final FloatLengthMatrix instantiateType(final FloatMatrixData fmd, final LengthUnit unit)
75      {
76          return new FloatLengthMatrix(fmd, unit);
77      }
78  
79      /** {@inheritDoc} */
80      @Override
81      protected final MutableFloatLengthMatrix instantiateMutableType(final FloatMatrixData fmd, final LengthUnit unit)
82      {
83          return new MutableFloatLengthMatrix(fmd, unit);
84      }
85  
86      /** {@inheritDoc} */
87      @Override
88      protected final FloatLength instantiateScalar(final float value, final LengthUnit unit)
89      {
90          return new FloatLength(value, unit);
91      }
92  
93  }