public class DensityVector extends AbstractDoubleVectorRel<DensityUnit,DensityVector,MutableDensityVector,Density>
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
AbstractDoubleVectorRel.Itr
data
Constructor and Description |
---|
DensityVector(Density[] values,
StorageType storageType)
Construct a new Relative Immutable Double DensityVector.
|
DensityVector(double[] values,
DensityUnit unit,
StorageType storageType)
Construct a new Relative Immutable Double DensityVector.
|
DensityVector(DoubleVectorData data,
DensityUnit unit) |
DensityVector(List<Density> values,
StorageType storageType)
Construct a new Relative Immutable Double DensityVector.
|
DensityVector(List<Double> values,
DensityUnit unit,
StorageType storageType)
Construct a new Relative Immutable Double DensityVector.
|
DensityVector(SortedMap<Integer,Density> values,
int length,
StorageType storageType)
Construct a new Relative Immutable Double DensityVector.
|
DensityVector(SortedMap<Integer,Double> values,
DensityUnit unit,
int length,
StorageType storageType)
Construct a new Relative Immutable Double DensityVector.
|
Modifier and Type | Method and Description |
---|---|
protected MutableDensityVector |
instantiateMutableType(DoubleVectorData dvd,
DensityUnit unit)
Construct a new Relative Mutable DoubleVector of the right type.
|
protected Density |
instantiateScalar(double value,
DensityUnit unit)
Construct a new Relative Immutable DoubleScalar of the right type.
|
protected DensityVector |
instantiateType(DoubleVectorData dvd,
DensityUnit unit)
Construct a new Relative Immutable DoubleVector of the right type.
|
Density[] |
toArray()
Return an array of Density Scalars from this vector.
|
DensityVector |
toDense()
return a dense version of this vector.
|
DensityVector |
toSparse()
return a sparse version of this vector.
|
checkUnit, checkUnit, checkUnit, divide, get, iterator, minus, mutable, plus, times
cardinality, checkIndex, checkSize, checkSize, equals, getData, getInUnit, getInUnit, getSI, getStorageType, getValuesInUnit, getValuesInUnit, getValuesSI, hashCode, size, toString, toString, toString, toString, zSum
expressAsSIUnit, expressAsSpecifiedUnit, getUnit, isAbsolute, isRelative, setDisplayUnit
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public DensityVector(double[] values, DensityUnit unit, StorageType storageType) throws ValueException
values
- double[]; the values of the entries in the new Relative Immutable Double DensityVectorunit
- DensityUnit; the unit of the new Relative Immutable Double DensityVectorstorageType
- StorageType; the data type to use (e.g., DENSE or SPARSE)ValueException
- when values is nullpublic DensityVector(List<Double> values, DensityUnit unit, StorageType storageType) throws ValueException
values
- List<Double>; the values of the entries in the new Relative Immutable Double DensityVectorunit
- DensityUnit; the unit of the new Relative Immutable Double DensityVectorstorageType
- StorageType; the data type to use (e.g., DENSE or SPARSE)ValueException
- when values is nullpublic DensityVector(Density[] values, StorageType storageType) throws ValueException
values
- Density[]; the values of the entries in the new Relative Immutable Double DensityVectorstorageType
- StorageType; the data type to use (e.g., DENSE or SPARSE)ValueException
- when values has zero entriespublic DensityVector(List<Density> values, StorageType storageType) throws ValueException
values
- List<Density>; the values of the entries in the new Relative Immutable Double DensityVectorstorageType
- StorageType; the data type to use (e.g., DENSE or SPARSE)ValueException
- when values has zero entriespublic DensityVector(SortedMap<Integer,Density> values, int length, StorageType storageType) throws ValueException
values
- SortedMap<Integer, Density>; the values of the entries in the new Relative Sparse Mutable Double
DensityVectorlength
- int; the size of the vectorstorageType
- StorageType; the data type to use (e.g., DENSE or SPARSE)ValueException
- when values has zero entriespublic DensityVector(SortedMap<Integer,Double> values, DensityUnit unit, int length, StorageType storageType) throws ValueException
values
- SortedMap<Integer, Double>; the map of indexes to values of the Relative Sparse Mutable Double
DensityVectorunit
- DensityUnit; the unit of the new Relative Sparse Mutable Double DensityVectorlength
- int; the size of the vectorstorageType
- StorageType; the data type to use (e.g., DENSE or SPARSE)ValueException
- when values is nullDensityVector(DoubleVectorData data, DensityUnit unit)
data
- DoubleVectorData; an internal data objectunit
- DensityUnit; the unitprotected final DensityVector instantiateType(DoubleVectorData dvd, DensityUnit unit)
instantiateType
in class AbstractDoubleVectorRel<DensityUnit,DensityVector,MutableDensityVector,Density>
dvd
- DoubleVectorData; an internal data objectunit
- U; the unitprotected final MutableDensityVector instantiateMutableType(DoubleVectorData dvd, DensityUnit unit)
instantiateMutableType
in class AbstractDoubleVectorRel<DensityUnit,DensityVector,MutableDensityVector,Density>
dvd
- DoubleVectorData; an internal data objectunit
- U; the unitprotected final Density instantiateScalar(double value, DensityUnit unit)
instantiateScalar
in class AbstractDoubleVectorRel<DensityUnit,DensityVector,MutableDensityVector,Density>
value
- double; the valueunit
- U; the unitpublic final DensityVector toDense()
public final DensityVector toSparse()
public Density[] toArray()
RuntimeException
- wrapping a ValueException on error getting one of the valuesCopyright © 2015–2019 Delft University of Technology. All rights reserved.