Class AbstractDoubleVectorAbs<AU extends AbsoluteLinearUnit<AU,​RU>,​A extends AbstractDoubleScalarAbs<AU,​A,​RU,​R>,​AV extends AbstractDoubleVectorAbs<AU,​A,​AV,​RU,​R,​RV>,​RU extends Unit<RU>,​R extends AbstractDoubleScalarRelWithAbs<AU,​A,​RU,​R>,​RV extends AbstractDoubleVectorRelWithAbs<AU,​A,​AV,​RU,​R,​RV>>

java.lang.Object
org.djunits.value.AbstractValue<U,​T>
org.djunits.value.AbstractIndexedValue<U,​S,​V,​DoubleVectorData>
org.djunits.value.vdouble.vector.base.AbstractDoubleVector<AU,​A,​AV>
org.djunits.value.vdouble.vector.base.AbstractDoubleVectorAbs<AU,​A,​AV,​RU,​R,​RV>
Type Parameters:
AU - the absolute unit belonging to the relative unit
A - the absolute scalar type belonging to the absolute vector type
AV - the (immutable or mutable) absolute vector type
RU - the relative unit belonging to the absolute unit
R - the relative scalar type belonging to the relative vector type
RV - the relative (immutable or mutable) vector type with this unit
All Implemented Interfaces:
Serializable, Cloneable, Iterable<A>, Absolute, Vector<AU,​A,​AV>, Vector.Abs<AU,​A,​AV,​RU,​R,​RV>, ValueFunctions<AU,​AV>, IndexedValue<AU,​A,​AV>, Value<AU,​AV>, DoubleVectorInterface<AU,​A,​AV>
Direct Known Subclasses:
AbsoluteTemperatureVector, DirectionVector, PositionVector, TimeVector

public abstract class AbstractDoubleVectorAbs<AU extends AbsoluteLinearUnit<AU,​RU>,​A extends AbstractDoubleScalarAbs<AU,​A,​RU,​R>,​AV extends AbstractDoubleVectorAbs<AU,​A,​AV,​RU,​R,​RV>,​RU extends Unit<RU>,​R extends AbstractDoubleScalarRelWithAbs<AU,​A,​RU,​R>,​RV extends AbstractDoubleVectorRelWithAbs<AU,​A,​AV,​RU,​R,​RV>>
extends AbstractDoubleVector<AU,​A,​AV>
implements Vector.Abs<AU,​A,​AV,​RU,​R,​RV>, Absolute
AbstractMutableDoubleVectorRelWithAbs.java.

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
See Also:
Serialized Form
  • Constructor Details

    • AbstractDoubleVectorAbs

      protected AbstractDoubleVectorAbs​(DoubleVectorData data, AU unit)
      Construct a new Relative Mutable DoubleVector.
      Parameters:
      data - DoubleVectorData; an internal data object
      unit - AU; the unit
  • Method Details

    • plus

      public AV plus​(RV increment) throws ValueRuntimeException
      Add a relative vector to this absolute vector. A new absolute vector is returned. The display unit of the new vector is the display unit of this absolute vector. The addition is done value by value and the result is stored in a new vector. If both operands are sparse, the result is a sparse vector, otherwise the result is a dense vector.
      Specified by:
      plus in interface Vector.Abs<AU extends AbsoluteLinearUnit<AU,​RU>,​A extends AbstractDoubleScalarAbs<AU,​A,​RU,​R>,​AV extends AbstractDoubleVectorAbs<AU,​A,​AV,​RU,​R,​RV>,​RU extends Unit<RU>,​R extends AbstractDoubleScalarRelWithAbs<AU,​A,​RU,​R>,​RV extends AbstractDoubleVectorRelWithAbs<AU,​A,​AV,​RU,​R,​RV>>
      Parameters:
      increment - RV; the relative vector (mutable or immutable, sparse or dense) to add to this absolute vector
      Returns:
      AIV; the sum of this value and the operand as a new absolute, immutable vector
      Throws:
      ValueRuntimeException - in case this vector and the operand have a different size
    • minus

      public AV minus​(RV decrement) throws ValueRuntimeException
      Subtract a relative vector from this absolute vector. A new absolute vector is returned. The display unit of the new vector is the display unit of this absolute vector. The subtraction is done value by value and the result is stored in a new vector. If both operands are sparse, the result is a sparse vector, otherwise the result is a dense vector.
      Specified by:
      minus in interface Vector.Abs<AU extends AbsoluteLinearUnit<AU,​RU>,​A extends AbstractDoubleScalarAbs<AU,​A,​RU,​R>,​AV extends AbstractDoubleVectorAbs<AU,​A,​AV,​RU,​R,​RV>,​RU extends Unit<RU>,​R extends AbstractDoubleScalarRelWithAbs<AU,​A,​RU,​R>,​RV extends AbstractDoubleVectorRelWithAbs<AU,​A,​AV,​RU,​R,​RV>>
      Parameters:
      decrement - RV; the relative vector (mutable or immutable, sparse or dense) to subtract from this absolute vector
      Returns:
      AIV; the difference of this value and the operand as a new absolute, immutable vector
      Throws:
      ValueRuntimeException - in case this vector and the operand have a different size
    • minus

      public RV minus​(AV decrement) throws ValueRuntimeException
      Subtract an absolute vector from this absolute vector. A new relative vector is returned. The display unit of the new vector is the display unit of relative counterpart of the display unit of this absolute vector. The subtraction is done value by value and the result is stored in a new vector. If both operands are sparse, the result is a sparse vector, otherwise the result is a dense vector.
      Specified by:
      minus in interface Vector.Abs<AU extends AbsoluteLinearUnit<AU,​RU>,​A extends AbstractDoubleScalarAbs<AU,​A,​RU,​R>,​AV extends AbstractDoubleVectorAbs<AU,​A,​AV,​RU,​R,​RV>,​RU extends Unit<RU>,​R extends AbstractDoubleScalarRelWithAbs<AU,​A,​RU,​R>,​RV extends AbstractDoubleVectorRelWithAbs<AU,​A,​AV,​RU,​R,​RV>>
      Parameters:
      decrement - AV; the absolute vector (mutable or immutable, sparse or dense) to subtract from this absolute vector
      Returns:
      RIV; the difference of this value and the operand as a new relative, immutable vector
      Throws:
      ValueRuntimeException - in case this vector and the operand have a different size
    • decrementBy

      public AV decrementBy​(R decrement)
      Decrement all values of this vector by the decrement. This only works if this vector is mutable.
      Parameters:
      decrement - R; the scalar by which to decrement all values
      Returns:
      AV; this modified vector
      Throws:
      ValueRuntimeException - in case this vector is immutable
    • decrementBy

      public AV decrementBy​(RV decrement)
      Decrement all values of this vector by the decrement on a value by value basis. This only works if this vector is mutable.
      Parameters:
      decrement - RV; the vector that contains the values by which to decrement the corresponding values
      Returns:
      AV; this modified vector
      Throws:
      ValueRuntimeException - in case this vector is immutable, when the sizes of the vectors differ, or decrement is null
    • instantiateVectorRel

      public abstract RV instantiateVectorRel​(DoubleVectorData dvd, RU displayUnit)
      Instantiate a new relative vector of the class of this absolute vector. This can be used instead of the DoubleVector.instiantiate() methods in case another vector of this absolute vector 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 - RU; the display unit of the relative vector
      Returns:
      RV; a relative vector of the correct type, belonging to this absolute vector type
    • instantiateScalarRelSI

      public abstract R instantiateScalarRelSI​(double valueSI, RU displayUunit)
      Instantiate a new relative scalar for the class of this absolute 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 relative scalar
      displayUunit - RU; the unit in which the relative value will be displayed
      Returns:
      R; a relative scalar of the correct type, belonging to this absolute vector type