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