View Javadoc
1   package org.djunits.value.vdouble.vector;
2   
3   import java.util.List;
4   import java.util.SortedMap;
5   
6   import org.djunits.unit.AbsoluteLinearUnit;
7   import org.djunits.unit.Unit;
8   import org.djunits.value.StorageType;
9   import org.djunits.value.ValueException;
10  import org.djunits.value.vdouble.scalar.DoubleScalar;
11  
12  /**
13   * MutableDoubleVector.
14   * <p>
15   * This file was generated by the djunits value classes generator, 26 jun, 2015
16   * <p>
17   * Copyright (c) 2015-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
18   * BSD-style license. See <a href="http://djunits.org/docs/license.html">DJUNITS License</a>.
19   * <p>
20   * $LastChangedDate: 2019-01-18 00:35:01 +0100 (Fri, 18 Jan 2019) $, @version $Revision: 324 $, by $Author: averbraeck $,
21   * initial version 30 Oct, 2015 <br>
22   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
23   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
24   */
25  public abstract class MutableDoubleVector
26  {
27      /**
28       * Absolute Immutable DoubleVector.
29       * @param <AU> Absolute unit
30       * @param <RU> Relative unit
31       */
32      public static class Abs<AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>> extends AbstractMutableDoubleVectorAbs<
33              AU, RU, DoubleVector.Abs<AU, RU>, DoubleVector.Rel<RU>, MutableDoubleVector.Abs<AU, RU>, DoubleScalar.Abs<AU, RU>>
34      {
35          /**  */
36          private static final long serialVersionUID = 20150626L;
37  
38          /**
39           * Construct a new Absolute Mutable DoubleVector.
40           * @param values double[]; the values of the entries in the new Absolute Mutable DoubleVector
41           * @param unit AU; the unit of the new Absolute Mutable DoubleVector
42           * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
43           * @throws ValueException when values is null
44           */
45          public Abs(final double[] values, final AU unit, final StorageType storageType) throws ValueException
46          {
47              super(values, unit, storageType);
48          }
49  
50          /**
51           * Construct a new Absolute Mutable DoubleVector.
52           * @param values List&lt;Double&gt;; the values of the entries in the new Absolute Mutable DoubleVector
53           * @param unit AU; the unit of the new Absolute Mutable DoubleVector
54           * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
55           * @throws ValueException when values is null
56           */
57          public Abs(final List<Double> values, final AU unit, final StorageType storageType) throws ValueException
58          {
59              super(values, unit, storageType);
60          }
61  
62          /**
63           * Construct a new Absolute Mutable DoubleVector.
64           * @param values DoubleScalar.Abs&lt;AU, RU&gt;[]; the values of the entries in the new Absolute Mutable DoubleVector
65           * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
66           * @throws ValueException when values has zero entries
67           */
68          public Abs(final DoubleScalar.Abs<AU, RU>[] values, final StorageType storageType) throws ValueException
69          {
70              super(values, storageType);
71          }
72  
73          /**
74           * Construct a new Absolute Mutable DoubleVector.
75           * @param values List&lt;DoubleScalar.Abs&lt;AU, RU&gt;&gt;; the values of the entries in the new Absolute Mutable
76           *            DoubleVector
77           * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
78           * @throws ValueException when values has zero entries
79           */
80          public Abs(final List<DoubleScalar.Abs<AU, RU>> values, final StorageType storageType) throws ValueException
81          {
82              super(values, storageType);
83          }
84  
85          /**
86           * Construct a new Absolute Mutable DoubleVector.
87           * @param values SortedMap&lt;Integer, DoubleScalar.Abs&lt;AU, RU&gt;&gt;; the values of the entries in the new Absolute
88           *            Sparse Mutable DoubleVector
89           * @param length int; the size of the vector
90           * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
91           * @throws ValueException when values has zero entries
92           */
93          public Abs(final SortedMap<Integer, DoubleScalar.Abs<AU, RU>> values, final int length, final StorageType storageType)
94                  throws ValueException
95          {
96              super(values, length, storageType);
97          }
98  
99          /**
100          * Construct a new Absolute Mutable DoubleVector.
101          * @param values SortedMap&lt;Integer, Double&gt;; the map of indexes to values of the Absolute Sparse Mutable
102          *            DoubleVector
103          * @param unit AU; the unit of the new Absolute Sparse Mutable DoubleVector
104          * @param length int; the size of the vector
105          * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
106          * @throws ValueException when values is null
107          */
108         public Abs(final SortedMap<Integer, Double> values, final AU unit, final int length, final StorageType storageType)
109                 throws ValueException
110         {
111             super(values, unit, length, storageType);
112         }
113 
114         /**
115          * Construct a new Absolute Mutable DoubleVector.
116          * @param data DoubleVectorData; an internal data object
117          * @param unit AU; the unit
118          */
119         public Abs(final DoubleVectorData data, final AU unit)
120         {
121             super(data, unit);
122         }
123 
124         /** {@inheritDoc} */
125         @Override
126         protected final DoubleVector.Abs<AU, RU> instantiateTypeAbs(final DoubleVectorData dvd, final AU unit)
127         {
128             return new DoubleVector.Abs<AU, RU>(dvd, unit);
129         }
130 
131         /** {@inheritDoc} */
132         @Override
133         protected final DoubleVector.Rel<RU> instantiateTypeRel(final DoubleVectorData dvd, final RU unit)
134         {
135             return new DoubleVector.Rel<RU>(dvd, unit);
136         }
137 
138         /** {@inheritDoc} */
139         @Override
140         protected final MutableDoubleVector.Abs<AU, RU> instantiateMutableType(final DoubleVectorData dvd, final AU unit)
141         {
142             return new MutableDoubleVector.Abs<AU, RU>(dvd, unit);
143         }
144 
145         /** {@inheritDoc} */
146         @Override
147         protected final DoubleScalar.Abs<AU, RU> instantiateScalar(final double value, final AU unit)
148         {
149             return new DoubleScalar.Abs<AU, RU>(value, unit);
150         }
151 
152         /** {@inheritDoc} */
153         @Override
154         public final MutableDoubleVector.Abs<AU, RU> toDense()
155         {
156             return this.data.isDense() ? (MutableDoubleVector.Abs<AU, RU>) this
157                     : instantiateMutableType(this.data.toDense(), getUnit());
158         }
159 
160         /** {@inheritDoc} */
161         @Override
162         public final MutableDoubleVector.Abs<AU, RU> toSparse()
163         {
164             return this.data.isSparse() ? (MutableDoubleVector.Abs<AU, RU>) this
165                     : instantiateMutableType(this.data.toSparse(), getUnit());
166         }
167     }
168 
169     /**
170      * Relative Immutable DoubleVector.
171      * @param <U> Unit
172      */
173     public static class Rel<U extends Unit<U>>
174             extends AbstractMutableDoubleVectorRel<U, DoubleVector.Rel<U>, MutableDoubleVector.Rel<U>, DoubleScalar.Rel<U>>
175     {
176         /**  */
177         private static final long serialVersionUID = 20150626L;
178 
179         /**
180          * Construct a new Relative Mutable DoubleVector.
181          * @param values double[]; the values of the entries in the new Relative Mutable DoubleVector
182          * @param unit U; the unit of the new Relative Mutable DoubleVector
183          * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
184          * @throws ValueException when values is null
185          */
186         public Rel(final double[] values, final U unit, final StorageType storageType) throws ValueException
187         {
188             super(values, unit, storageType);
189         }
190 
191         /**
192          * Construct a new Relative Mutable DoubleVector.
193          * @param values List&lt;Double&gt;; the values of the entries in the new Relative Mutable DoubleVector
194          * @param unit U; the unit of the new Relative Mutable DoubleVector
195          * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
196          * @throws ValueException when values is null
197          */
198         public Rel(final List<Double> values, final U unit, final StorageType storageType) throws ValueException
199         {
200             super(values, unit, storageType);
201         }
202 
203         /**
204          * Construct a new Relative Mutable DoubleVector.
205          * @param values DoubleScalar.Rel&lt;U&gt;[]; the values of the entries in the new Relative Mutable DoubleVector
206          * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
207          * @throws ValueException when values has zero entries
208          */
209         public Rel(final DoubleScalar.Rel<U>[] values, final StorageType storageType) throws ValueException
210         {
211             super(values, storageType);
212         }
213 
214         /**
215          * Construct a new Relative Mutable DoubleVector.
216          * @param values List&lt;DoubleScalar.Rel&lt;U&gt;&gt;; the values of the entries in the new Relative Mutable
217          *            DoubleVector
218          * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
219          * @throws ValueException when values has zero entries
220          */
221         public Rel(final List<DoubleScalar.Rel<U>> values, final StorageType storageType) throws ValueException
222         {
223             super(values, storageType);
224         }
225 
226         /**
227          * Construct a new Relative Mutable DoubleVector.
228          * @param values SortedMap&lt;Integer, DoubleScalar.Rel&lt;U&gt;&gt;; the values of the entries in the new Relative
229          *            Sparse Mutable DoubleVector
230          * @param length int; the size of the vector
231          * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
232          * @throws ValueException when values has zero entries
233          */
234         public Rel(final SortedMap<Integer, DoubleScalar.Rel<U>> values, final int length, final StorageType storageType)
235                 throws ValueException
236         {
237             super(values, length, storageType);
238         }
239 
240         /**
241          * Construct a new Relative Mutable DoubleVector.
242          * @param values SortedMap&lt;Integer, Double&gt;; the map of indexes to values of the Relative Sparse Mutable
243          *            DoubleVector
244          * @param unit U; the unit of the new Relative Sparse Mutable DoubleVector
245          * @param length int; the size of the vector
246          * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
247          * @throws ValueException when values is null
248          */
249         public Rel(final SortedMap<Integer, Double> values, final U unit, final int length, final StorageType storageType)
250                 throws ValueException
251         {
252             super(values, unit, length, storageType);
253         }
254 
255         /**
256          * Construct a new Relative Mutable DoubleVector.
257          * @param data DoubleVectorData; an internal data object
258          * @param unit U; the unit
259          */
260         public Rel(final DoubleVectorData data, final U unit)
261         {
262             super(data, unit);
263         }
264 
265         /** {@inheritDoc} */
266         @Override
267         protected final DoubleVector.Rel<U> instantiateType(final DoubleVectorData dvd, final U unit)
268         {
269             return new DoubleVector.Rel<U>(dvd, unit);
270         }
271 
272         /** {@inheritDoc} */
273         @Override
274         protected final MutableDoubleVector.Rel<U> instantiateMutableType(final DoubleVectorData dvd, final U unit)
275         {
276             return new MutableDoubleVector.Rel<U>(dvd, unit);
277         }
278 
279         /** {@inheritDoc} */
280         @Override
281         protected final DoubleScalar.Rel<U> instantiateScalar(final double value, final U unit)
282         {
283             return new DoubleScalar.Rel<U>(value, unit);
284         }
285 
286         /** {@inheritDoc} */
287         @Override
288         public final MutableDoubleVector.Rel<U> toDense()
289         {
290             return this.data.isDense() ? (MutableDoubleVector.Rel<U>) this
291                     : instantiateMutableType(this.data.toDense(), getUnit());
292         }
293 
294         /** {@inheritDoc} */
295         @Override
296         public final MutableDoubleVector.Rel<U> toSparse()
297         {
298             return this.data.isSparse() ? (MutableDoubleVector.Rel<U>) this
299                     : instantiateMutableType(this.data.toSparse(), getUnit());
300         }
301 
302     }
303 
304 }