Interface DoubleVectorInterface<U extends Unit<U>,​S extends DoubleScalarInterface<U,​S>,​V extends DoubleVectorInterface<U,​S,​V>>

Type Parameters:
U - the unit
S - the generic scalar type belonging to U
V - 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
  • Method Details

    • getSI

      double getSI​(int index) throws ValueRuntimeException
      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

      double getInUnit​(int index) throws ValueRuntimeException
      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

      double getInUnit​(int index, U targetUnit) throws ValueRuntimeException
      Retrieve the value stored at a specified position converted into a specified unit.
      Parameters:
      index - int; index of the value to retrieve
      targetUnit - 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

      double[] getValuesInUnit​(U targetUnit)
      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

      void setSI​(int index, double valueSI) throws ValueRuntimeException
      Set the value, specified in the standard SI unit, at the specified position.
      Parameters:
      index - int; the index of the value to set
      valueSI - double; the value, specified in the standard SI unit
      Throws:
      ValueRuntimeException - when index out of range (index < 0 or index >= size())
    • setInUnit

      void setInUnit​(int index, double valueInUnit) throws ValueRuntimeException
      Set the value, specified in the (current) display unit, at the specified position.
      Parameters:
      index - int; the index of the value to set
      valueInUnit - double; the value, specified in the (current) display unit
      Throws:
      ValueRuntimeException - when index out of range (index < 0 or index >= size())
    • setInUnit

      void setInUnit​(int index, double valueInUnit, U valueUnit) throws ValueRuntimeException
      Set the value, specified in the valueUnit, at the specified position.
      Parameters:
      index - int; the index of the value to set
      valueInUnit - double; the value, specified in the (current) display unit
      valueUnit - U; the unit in which the valueInUnit is expressed
      Throws:
      ValueRuntimeException - when index out of range (index < 0 or index >= size())
    • set

      void set​(int index, S value) throws ValueRuntimeException
      Set the scalar value at the specified position.
      Parameters:
      index - int; the index of the value to set
      value - S; the value to set
      Throws:
      ValueRuntimeException - when index out of range (index < 0 or index >= size())
    • assign

      V assign​(DoubleFunction doubleFunction)
      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

      V instantiateVector​(DoubleVectorData dvd, U displayUnit)
      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 vector
      displayUnit - U; the display unit of the vector
      Returns:
      V; a vector of the correct type
    • instantiateScalarSI

      S instantiateScalarSI​(double valueSI, U displayUnit)
      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 scalar
      displayUnit - U; the unit in which the value will be displayed
      Returns:
      S; a scalar of the correct type, belonging to the vector type