Interface Vector<U extends Unit<U>,​S extends Scalar<U,​S>,​V extends Vector<U,​S,​V>>

Type Parameters:
U - the unit
S - the scalar type belonging to the vector type
V - the vector type with the given unit
All Superinterfaces:
Cloneable, IndexedValue<U,​S,​V>, Iterable<S>, Serializable, Value<U,​V>, ValueFunctions<U,​V>
All Known Subinterfaces:
DoubleVectorInterface<U,​S,​V>, FloatVectorInterface<U,​S,​V>, Vector.Abs<AU,​A,​AV,​RU,​R,​RV>, Vector.Rel<U,​S,​RV>, Vector.RelWithAbs<AU,​A,​AV,​RU,​R,​RV>
All Known Implementing Classes:
AbsoluteTemperatureVector, AbsorbedDoseVector, AbstractDoubleVector, AbstractDoubleVectorAbs, AbstractDoubleVectorRel, AbstractDoubleVectorRelWithAbs, AbstractFloatVector, AbstractFloatVectorAbs, AbstractFloatVectorRel, AbstractFloatVectorRelWithAbs, AccelerationVector, AmountOfSubstanceVector, AngleVector, AngularAccelerationVector, AngularVelocityVector, AreaVector, CatalyticActivityVector, DensityVector, DimensionlessVector, DirectionVector, DurationVector, ElectricalCapacitanceVector, ElectricalChargeVector, ElectricalConductanceVector, ElectricalCurrentVector, ElectricalInductanceVector, ElectricalPotentialVector, ElectricalResistanceVector, EnergyVector, EquivalentDoseVector, FloatAbsoluteTemperatureVector, FloatAbsorbedDoseVector, FloatAccelerationVector, FloatAmountOfSubstanceVector, FloatAngleVector, FloatAngularAccelerationVector, FloatAngularVelocityVector, FloatAreaVector, FloatCatalyticActivityVector, FloatDensityVector, FloatDimensionlessVector, FloatDirectionVector, FloatDurationVector, FloatElectricalCapacitanceVector, FloatElectricalChargeVector, FloatElectricalConductanceVector, FloatElectricalCurrentVector, FloatElectricalInductanceVector, FloatElectricalPotentialVector, FloatElectricalResistanceVector, FloatEnergyVector, FloatEquivalentDoseVector, FloatFlowMassVector, FloatFlowVolumeVector, FloatForceVector, FloatFrequencyVector, FloatIlluminanceVector, FloatLengthVector, FloatLinearDensityVector, FloatLuminousFluxVector, FloatLuminousIntensityVector, FloatMagneticFluxDensityVector, FloatMagneticFluxVector, FloatMassVector, FloatMomentumVector, FloatPositionVector, FloatPowerVector, FloatPressureVector, FloatRadioActivityVector, FloatSIVector, FloatSolidAngleVector, FloatSpeedVector, FloatTemperatureVector, FloatTimeVector, FloatTorqueVector, FloatVolumeVector, FlowMassVector, FlowVolumeVector, ForceVector, FrequencyVector, IlluminanceVector, LengthVector, LinearDensityVector, LuminousFluxVector, LuminousIntensityVector, MagneticFluxDensityVector, MagneticFluxVector, MassVector, MomentumVector, PositionVector, PowerVector, PressureVector, RadioActivityVector, SIVector, SolidAngleVector, SpeedVector, TemperatureVector, TimeVector, TorqueVector, VolumeVector

public interface Vector<U extends Unit<U>,​S extends Scalar<U,​S>,​V extends Vector<U,​S,​V>>
extends IndexedValue<U,​S,​V>, Iterable<S>
Vector to distinguish a vector from vectors and matrices. A possible way to implement this interface is:
 class LengthVector implements Vector<LengthUnit, Length, LengthVector>
 
Copyright (c) 2019-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
Author:
Alexander Verbraeck
  • Method Details

    • size

      int size()
      Retrieve the size of the vector.
      Returns:
      int; the size of the vector
    • get

      S get​(int index) throws ValueRuntimeException
      Retrieve a value from the vector.
      Parameters:
      index - int; the index to retrieve the value at
      Returns:
      S; the value as a Scalar
      Throws:
      ValueRuntimeException - in case index is out of bounds
    • getScalars

      S[] getScalars()
      Return the vector as an array of scalars.
      Returns:
      S[]; the vector as an array of scalars
    • iterator

      Iterator<S> iterator()
      Create and return an iterator over the scalars in this vector in proper sequence.
      Specified by:
      iterator in interface Iterable<U extends Unit<U>>
      Returns:
      Iterator<S>; an iterator over the scalars in this vector in proper sequence