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