Interface DoubleVectorInterface<U extends Unit<U>,S extends DoubleScalarInterface<U,S>,V extends DoubleVectorInterface<U,S,V>>
- Type Parameters:
U
- the unitS
- the generic scalar type belonging to UV
- the generic vector type
- All Superinterfaces:
Cloneable
,IndexedValue<U,S,V>
,Iterable<S>
,Serializable
,Value<U,V>
,ValueFunctions<U,V>
,Vector<U,S,V>
- All Known Implementing Classes:
AbsoluteTemperatureVector
,AbsorbedDoseVector
,AbstractDoubleVector
,AbstractDoubleVectorAbs
,AbstractDoubleVectorRel
,AbstractDoubleVectorRelWithAbs
,AccelerationVector
,AmountOfSubstanceVector
,AngleVector
,AreaVector
,CatalyticActivityVector
,DensityVector
,DimensionlessVector
,DirectionVector
,DurationVector
,ElectricalCapacitanceVector
,ElectricalChargeVector
,ElectricalConductanceVector
,ElectricalCurrentVector
,ElectricalInductanceVector
,ElectricalPotentialVector
,ElectricalResistanceVector
,EnergyVector
,EquivalentDoseVector
,FlowMassVector
,FlowVolumeVector
,ForceVector
,FrequencyVector
,IlluminanceVector
,LengthVector
,LinearDensityVector
,LuminousFluxVector
,LuminousIntensityVector
,MagneticFluxDensityVector
,MagneticFluxVector
,MassVector
,PositionVector
,PowerVector
,PressureVector
,RadioActivityVector
,SIVector
,SolidAngleVector
,SpeedVector
,TemperatureVector
,TimeVector
,TorqueVector
,VolumeVector
public interface DoubleVectorInterface<U extends Unit<U>,S extends DoubleScalarInterface<U,S>,V extends DoubleVectorInterface<U,S,V>> extends Vector<U,S,V>
Interface for the DoubleVector classes, specifically defining the methods that deal with double values.
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.
- Author:
- Alexander Verbraeck, Peter Knoppers
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.djunits.value.base.Vector
Vector.Abs<AU extends AbsoluteLinearUnit<AU,RU>,A extends Scalar<AU,A>,AV extends Vector.Abs<AU,A,AV,RU,R,RV>,RU extends Unit<RU>,R extends Scalar<RU,R>,RV extends Vector.RelWithAbs<AU,A,AV,RU,R,RV>>, Vector.Rel<U extends Unit<U>,S extends Scalar<U,S>,RV extends Vector.Rel<U,S,RV>>, Vector.RelWithAbs<AU extends AbsoluteLinearUnit<AU,RU>,A extends Scalar<AU,A>,AV extends Vector.Abs<AU,A,AV,RU,R,RV>,RU extends Unit<RU>,R extends Scalar<RU,R>,RV extends Vector.RelWithAbs<AU,A,AV,RU,R,RV>>
-
Method Summary
Modifier and Type Method Description V
assign(DoubleFunction doubleFunction)
Execute a function on a cell by cell basis.double
getInUnit(int index)
Retrieve the value stored at a specified position in the original unit.double
getInUnit(int index, U targetUnit)
Retrieve the value stored at a specified position converted into a specified unit.double
getSI(int index)
Retrieve the value stored at a specified position in the standard SI unit.double[]
getValuesInUnit()
Create a double[] array filled with the values in the original unit.double[]
getValuesInUnit(U targetUnit)
Create a double[] array filled with the values converted into a specified unit.double[]
getValuesSI()
Create a double[] array filled with the values in the standard SI unit.S
instantiateScalarSI(double valueSI, U displayUnit)
Instantiate a new scalar for the class of this vector.V
instantiateVector(DoubleVectorData dvd, U displayUnit)
Instantiate a new vector of the class of this vector.void
set(int index, S value)
Set the scalar value at the specified position.void
setInUnit(int index, double valueInUnit)
Set the value, specified in the (current) display unit, at the specified position.void
setInUnit(int index, double valueInUnit, U valueUnit)
Set the value, specified in thevalueUnit
, at the specified position.void
setSI(int index, double valueSI)
Set the value, specified in the standard SI unit, at the specified position.Methods inherited from interface org.djunits.value.IndexedValue
cardinality, getScalarClass, getStorageType, immutable, isDense, isMutable, isSparse, mutable, toDense, toSparse
Methods inherited from interface org.djunits.value.Value
getDisplayUnit, isAbsolute, isRelative, setDisplayUnit, toString, toString, toString, toString
-
Method Details
-
getSI
Retrieve the value stored at a specified position in the standard SI unit.- Parameters:
index
- int; index of the value to retrieve- Returns:
- double; value at position index in the standard SI unit
- Throws:
ValueRuntimeException
- when index out of range (index < 0 or index >= size())
-
getInUnit
Retrieve the value stored at a specified position in the original unit.- Parameters:
index
- int; index of the value to retrieve- Returns:
- double; value at position index in the original unit
- Throws:
ValueRuntimeException
- when index out of range (index < 0 or index >= size())
-
getInUnit
Retrieve the value stored at a specified position converted into a specified unit.- Parameters:
index
- int; index of the value to retrievetargetUnit
- U; the unit for the result- Returns:
- double; value at position index converted into the specified unit
- Throws:
ValueRuntimeException
- when index out of range (index < 0 or index >= size())
-
getValuesSI
double[] getValuesSI()Create a double[] array filled with the values in the standard SI unit.- Returns:
- double[]; array of values in the standard SI unit
-
getValuesInUnit
double[] getValuesInUnit()Create a double[] array filled with the values in the original unit.- Returns:
- double[]; the values in the original unit
-
getValuesInUnit
Create a double[] array filled with the values converted into a specified unit.- Parameters:
targetUnit
- U; the unit into which the values are converted for use- Returns:
- double[]; the values converted into the specified unit
-
setSI
Set the value, specified in the standard SI unit, at the specified position.- Parameters:
index
- int; the index of the value to setvalueSI
- double; the value, specified in the standard SI unit- Throws:
ValueRuntimeException
- when index out of range (index < 0 or index >= size())
-
setInUnit
Set the value, specified in the (current) display unit, at the specified position.- Parameters:
index
- int; the index of the value to setvalueInUnit
- double; the value, specified in the (current) display unit- Throws:
ValueRuntimeException
- when index out of range (index < 0 or index >= size())
-
setInUnit
Set the value, specified in thevalueUnit
, at the specified position.- Parameters:
index
- int; the index of the value to setvalueInUnit
- double; the value, specified in the (current) display unitvalueUnit
- U; the unit in which thevalueInUnit
is expressed- Throws:
ValueRuntimeException
- when index out of range (index < 0 or index >= size())
-
set
Set the scalar value at the specified position.- Parameters:
index
- int; the index of the value to setvalue
- S; the value to set- Throws:
ValueRuntimeException
- when index out of range (index < 0 or index >= size())
-
assign
Execute a function on a cell by cell basis. Note: May be expensive when used on sparse data.- Parameters:
doubleFunction
- DoubleFunction; the function to apply- Returns:
- V; this updated vector
-
instantiateVector
Instantiate a new vector of the class of this vector. This can be used instead of the DoubleVector.instiantiate() methods in case another vector of this class is known. The method is faster than DoubleVector.instantiate, and it will also work if the vector is user-defined.- Parameters:
dvd
- DoubleVectorData; the data used to instantiate the vectordisplayUnit
- U; the display unit of the vector- Returns:
- V; a vector of the correct type
-
instantiateScalarSI
Instantiate a new scalar for the class of this vector. This can be used instead of the DoubleScalar.instiantiate() methods in case a vector of this class is known. The method is faster than DoubleScalar.instantiate, and it will also work if the vector and/or scalar are user-defined.- Parameters:
valueSI
- double; the SI value of the scalardisplayUnit
- U; the unit in which the value will be displayed- Returns:
- S; a scalar of the correct type, belonging to the vector type
-