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-2018 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: 2018-01-28 03:17:44 +0100 (Sun, 28 Jan 2018) $, @version $Revision: 256 $, 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 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; 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 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.Rel&lt;U&gt;[]; the values of the entries in the new Absolute Mutable DoubleVector
65           * @param 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; the values of the entries in the new Absolute Mutable DoubleVector
76           * @param storageType the data type to use (e.g., DENSE or SPARSE)
77           * @throws ValueException when values has zero entries
78           */
79          public Abs(final List<DoubleScalar.Abs<AU, RU>> values, final StorageType storageType) throws ValueException
80          {
81              super(values, storageType);
82          }
83  
84          /**
85           * Construct a new Absolute Mutable DoubleVector.
86           * @param values DoubleScalar.Rel&lt;U&gt;[]; the values of the entries in the new Absolute Sparse Mutable DoubleVector
87           * @param length the size of the vector
88           * @param storageType the data type to use (e.g., DENSE or SPARSE)
89           * @throws ValueException when values has zero entries
90           */
91          public Abs(final SortedMap<Integer, DoubleScalar.Abs<AU, RU>> values, final int length, final StorageType storageType)
92                  throws ValueException
93          {
94              super(values, length, storageType);
95          }
96  
97          /**
98           * Construct a new Absolute Mutable DoubleVector.
99           * @param values Map; the map of indexes to values of the Absolute Sparse Mutable DoubleVector
100          * @param unit AU; the unit of the new Absolute Sparse Mutable DoubleVector
101          * @param length the size of the vector
102          * @param storageType the data type to use (e.g., DENSE or SPARSE)
103          * @throws ValueException when values is null
104          */
105         public Abs(final SortedMap<Integer, Double> values, final AU unit, final int length, final StorageType storageType)
106                 throws ValueException
107         {
108             super(values, unit, length, storageType);
109         }
110 
111         /**
112          * Construct a new Absolute Mutable DoubleVector.
113          * @param data an internal data object
114          * @param unit the unit
115          */
116         public Abs(final DoubleVectorData data, final AU unit)
117         {
118             super(data, unit);
119         }
120 
121         /** {@inheritDoc} */
122         @Override
123         protected final DoubleVector.Abs<AU, RU> instantiateTypeAbs(final DoubleVectorData dvd, final AU unit)
124         {
125             return new DoubleVector.Abs<AU, RU>(dvd, unit);
126         }
127 
128         /** {@inheritDoc} */
129         @Override
130         protected final DoubleVector.Rel<RU> instantiateTypeRel(final DoubleVectorData dvd, final RU unit)
131         {
132             return new DoubleVector.Rel<RU>(dvd, unit);
133         }
134 
135         /** {@inheritDoc} */
136         @Override
137         protected final MutableDoubleVector.Abs<AU, RU> instantiateMutableType(final DoubleVectorData dvd, final AU unit)
138         {
139             return new MutableDoubleVector.Abs<AU, RU>(dvd, unit);
140         }
141 
142         /** {@inheritDoc} */
143         @Override
144         protected final DoubleScalar.Abs<AU, RU> instantiateScalar(final double value, final AU unit)
145         {
146             return new DoubleScalar.Abs<AU, RU>(value, unit);
147         }
148 
149         /** {@inheritDoc} */
150         @Override
151         public final MutableDoubleVector.Abs<AU, RU> toDense()
152         {
153             return this.data.isDense() ? (MutableDoubleVector.Abs<AU, RU>) this
154                     : instantiateMutableType(this.data.toDense(), getUnit());
155         }
156 
157         /** {@inheritDoc} */
158         @Override
159         public final MutableDoubleVector.Abs<AU, RU> toSparse()
160         {
161             return this.data.isSparse() ? (MutableDoubleVector.Abs<AU, RU>) this
162                     : instantiateMutableType(this.data.toSparse(), getUnit());
163         }
164     }
165 
166     /**
167      * Relative Immutable DoubleVector.
168      * @param <U> Unit
169      */
170     public static class Rel<U extends Unit<U>>
171             extends AbstractMutableDoubleVectorRel<U, DoubleVector.Rel<U>, MutableDoubleVector.Rel<U>, DoubleScalar.Rel<U>>
172     {
173         /**  */
174         private static final long serialVersionUID = 20150626L;
175 
176         /**
177          * Construct a new Relative Mutable DoubleVector.
178          * @param values double[]; the values of the entries in the new Relative Mutable DoubleVector
179          * @param unit U; the unit of the new Relative Mutable DoubleVector
180          * @param storageType the data type to use (e.g., DENSE or SPARSE)
181          * @throws ValueException when values is null
182          */
183         public Rel(final double[] values, final U unit, final StorageType storageType) throws ValueException
184         {
185             super(values, unit, storageType);
186         }
187 
188         /**
189          * Construct a new Relative Mutable DoubleVector.
190          * @param values List; the values of the entries in the new Relative Mutable DoubleVector
191          * @param unit U; the unit of the new Relative Mutable DoubleVector
192          * @param storageType the data type to use (e.g., DENSE or SPARSE)
193          * @throws ValueException when values is null
194          */
195         public Rel(final List<Double> values, final U unit, final StorageType storageType) throws ValueException
196         {
197             super(values, unit, storageType);
198         }
199 
200         /**
201          * Construct a new Relative Mutable DoubleVector.
202          * @param values DoubleScalar.Rel&lt;U&gt;[]; the values of the entries in the new Relative Mutable DoubleVector
203          * @param storageType the data type to use (e.g., DENSE or SPARSE)
204          * @throws ValueException when values has zero entries
205          */
206         public Rel(final DoubleScalar.Rel<U>[] values, final StorageType storageType) throws ValueException
207         {
208             super(values, storageType);
209         }
210 
211         /**
212          * Construct a new Relative Mutable DoubleVector.
213          * @param values List; the values of the entries in the new Relative Mutable DoubleVector
214          * @param storageType the data type to use (e.g., DENSE or SPARSE)
215          * @throws ValueException when values has zero entries
216          */
217         public Rel(final List<DoubleScalar.Rel<U>> values, final StorageType storageType) throws ValueException
218         {
219             super(values, storageType);
220         }
221 
222         /**
223          * Construct a new Relative Mutable DoubleVector.
224          * @param values DoubleScalar.Rel&lt;U&gt;[]; the values of the entries in the new Relative Sparse Mutable DoubleVector
225          * @param length the size of the vector
226          * @param storageType the data type to use (e.g., DENSE or SPARSE)
227          * @throws ValueException when values has zero entries
228          */
229         public Rel(final SortedMap<Integer, DoubleScalar.Rel<U>> values, final int length, final StorageType storageType)
230                 throws ValueException
231         {
232             super(values, length, storageType);
233         }
234 
235         /**
236          * Construct a new Relative Mutable DoubleVector.
237          * @param values Map; the map of indexes to values of the Relative Sparse Mutable DoubleVector
238          * @param unit U; the unit of the new Relative Sparse Mutable DoubleVector
239          * @param length the size of the vector
240          * @param storageType the data type to use (e.g., DENSE or SPARSE)
241          * @throws ValueException when values is null
242          */
243         public Rel(final SortedMap<Integer, Double> values, final U unit, final int length, final StorageType storageType)
244                 throws ValueException
245         {
246             super(values, unit, length, storageType);
247         }
248 
249         /**
250          * Construct a new Relative Mutable DoubleVector.
251          * @param data an internal data object
252          * @param unit the unit
253          */
254         public Rel(final DoubleVectorData data, final U unit)
255         {
256             super(data, unit);
257         }
258 
259         /** {@inheritDoc} */
260         @Override
261         protected final DoubleVector.Rel<U> instantiateType(final DoubleVectorData dvd, final U unit)
262         {
263             return new DoubleVector.Rel<U>(dvd, unit);
264         }
265 
266         /** {@inheritDoc} */
267         @Override
268         protected final MutableDoubleVector.Rel<U> instantiateMutableType(final DoubleVectorData dvd, final U unit)
269         {
270             return new MutableDoubleVector.Rel<U>(dvd, unit);
271         }
272 
273         /** {@inheritDoc} */
274         @Override
275         protected final DoubleScalar.Rel<U> instantiateScalar(final double value, final U unit)
276         {
277             return new DoubleScalar.Rel<U>(value, unit);
278         }
279 
280         /** {@inheritDoc} */
281         @Override
282         public final MutableDoubleVector.Rel<U> toDense()
283         {
284             return this.data.isDense() ? (MutableDoubleVector.Rel<U>) this
285                     : instantiateMutableType(this.data.toDense(), getUnit());
286         }
287 
288         /** {@inheritDoc} */
289         @Override
290         public final MutableDoubleVector.Rel<U> toSparse()
291         {
292             return this.data.isSparse() ? (MutableDoubleVector.Rel<U>) this
293                     : instantiateMutableType(this.data.toSparse(), getUnit());
294         }
295 
296     }
297 
298 }