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