Class AbstractDoubleVectorRel<U extends Unit<U>,S extends AbstractDoubleScalarRel<U,S>,RV extends AbstractDoubleVectorRel<U,S,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<U,S,RV>
org.djunits.value.vdouble.vector.base.AbstractDoubleVectorRel<U,S,RV>
- Type Parameters:
U
- the unitS
- the scalar type belonging to the vector typeRV
- the relative vector type with this unit
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<S>
,Vector<U,S,RV>
,Vector.Rel<U,S,RV>
,ValueFunctions<U,RV>
,IndexedValue<U,S,RV>
,Relative<U,RV>
,Value<U,RV>
,DoubleVectorInterface<U,S,RV>
- Direct Known Subclasses:
AbsorbedDoseVector
,AbstractDoubleVectorRelWithAbs
,AccelerationVector
,AmountOfSubstanceVector
,AngularAccelerationVector
,AngularVelocityVector
,AreaVector
,CatalyticActivityVector
,DensityVector
,DimensionlessVector
,ElectricalCapacitanceVector
,ElectricalChargeVector
,ElectricalConductanceVector
,ElectricalCurrentVector
,ElectricalInductanceVector
,ElectricalPotentialVector
,ElectricalResistanceVector
,EnergyVector
,EquivalentDoseVector
,FlowMassVector
,FlowVolumeVector
,ForceVector
,FrequencyVector
,IlluminanceVector
,LinearDensityVector
,LuminousFluxVector
,LuminousIntensityVector
,MagneticFluxDensityVector
,MagneticFluxVector
,MassVector
,MomentumVector
,PowerVector
,PressureVector
,RadioActivityVector
,SIVector
,SolidAngleVector
,SpeedVector
,TorqueVector
,VolumeVector
public abstract class AbstractDoubleVectorRel<U extends Unit<U>,S extends AbstractDoubleScalarRel<U,S>,RV extends AbstractDoubleVectorRel<U,S,RV>> extends AbstractDoubleVector<U,S,RV> implements Vector.Rel<U,S,RV>, Relative<U,RV>
AbstractMutableDoubleVectorRel.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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.djunits.value.vdouble.vector.base.AbstractDoubleVector
AbstractDoubleVector.Itr
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>>
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDoubleVectorRel(DoubleVectorData data, U unit)
Construct a new Relative Mutable DoubleVector. -
Method Summary
Modifier and Type Method Description RV
decrementBy(RV decrement)
Decrement all values of this vector by the decrement on a value by value basis.RV
decrementBy(S decrement)
Decrement all values of this vector by the decrement.RV
divide(double divisor)
Returns a new scalar/vector/matrix with value(s) divided by a factor.RV
divide(float divisor)
Returns a new scalar/vector/matrix with value(s) divided by a factor.<UT extends Unit<UT>, ST extends AbstractDoubleScalarRel<UT, ST>, VT extends AbstractDoubleVectorRel<UT, ST, VT>>
SIVectordivide(VT rel)
Divide this Relative value by a Relative value for a vector or matrix.RV
divideBy(double divisor)
Divide all values of this vector by the divisor.RV
incrementBy(RV increment)
Increment all values of this vector by the increment on a value by value basis.RV
incrementBy(S increment)
Increment all values of this vector by the increment.RV
minus(RV rel)
Subtract a relative vector from this relative mutable vector.RV
multiplyBy(double multiplier)
Multiply all values of this vector by the multiplier.RV
plus(RV rel)
Add a relative vector to this relative mutable vector.RV
times(double multiplier)
Returns a new scalar/vector/matrix with value(s) multiplied by a factor.RV
times(float multiplier)
Returns a new scalar/vector/matrix with value(s) multiplied by a factor.<UT extends Unit<UT>, ST extends AbstractDoubleScalarRel<UT, ST>, VT extends AbstractDoubleVectorRel<UT, ST, VT> & Relative<UT, VT>>
SIVectortimes(VT rel)
Multiply a Relative value with this Relative value for a vector or matrix.S
zSum()
Compute the sum of all SI values of this vector.Methods inherited from class org.djunits.value.vdouble.vector.base.AbstractDoubleVector
abs, assign, ceil, checkIndex, checkSize, equals, floor, get, getData, getInUnit, getInUnit, getScalars, getSI, getValuesInUnit, getValuesInUnit, getValuesSI, hashCode, iterator, neg, rint, set, setData, setInUnit, setInUnit, setSI, size, toDense, toSparse, toString, toString, toString, toString
Methods inherited from class org.djunits.value.AbstractIndexedValue
cardinality, checkCopyOnWrite, clone, getStorageType, immutable, isCopyOnWrite, isDense, isMutable, isSparse, mutable, setCopyOnWrite, setMutable
Methods inherited from class org.djunits.value.AbstractValue
getDisplayUnit, isAbsolute, isRelative, setDisplayUnit
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.djunits.value.vdouble.vector.base.DoubleVectorInterface
instantiateScalarSI, instantiateVector
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
-
Constructor Details
-
AbstractDoubleVectorRel
Construct a new Relative Mutable DoubleVector.- Parameters:
data
- DoubleVectorData; an internal data objectunit
- U; the unit
-
-
Method Details
-
zSum
Compute the sum of all SI values of this vector.- Returns:
- S; the sum of all SI values of this vector with the same display unit as this vector
-
plus
Add a relative vector to this relative mutable vector. A new vector is returned. When the vector itself needs to be changed, use the increaseBy(V) method instead. 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 interfaceVector.Rel<U extends Unit<U>,S extends AbstractDoubleScalarRel<U,S>,RV extends AbstractDoubleVectorRel<U,S,RV>>
- Parameters:
rel
- RV; the relative vector (mutable or immutable, sparse or dense) to add- Returns:
- RMV; the sum of this vector and the operand as a new relative, mutable vector
- Throws:
ValueRuntimeException
- in case this vector and the operand have a different size
-
minus
Subtract a relative vector from this relative mutable vector. The display unit of the result 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 interfaceVector.Rel<U extends Unit<U>,S extends AbstractDoubleScalarRel<U,S>,RV extends AbstractDoubleVectorRel<U,S,RV>>
- Parameters:
rel
- RV; the value to subtract- Returns:
- RMV; the difference of this vector and the operand as a new relative, mutable vector
- Throws:
ValueRuntimeException
- in case this vector and the operand have a different size
-
incrementBy
Increment all values of this vector by the increment. This only works if the vector is mutable.- Parameters:
increment
- S; the scalar by which to increment all values- Returns:
- RV; this modified vector
- Throws:
ValueRuntimeException
- in case this vector is immutable
-
incrementBy
Increment all values of this vector by the increment on a value by value basis. This only works if this vector is mutable.- Parameters:
increment
- RV; the vector that contains the values by which to increment the corresponding values- Returns:
- RV; this modified vector
- Throws:
ValueRuntimeException
- in case this vector is immutable, when the sizes of the vectors differ, orincrement
is null
-
decrementBy
Decrement all values of this vector by the decrement. This only works if the vector is mutable.- Parameters:
decrement
- S; the scalar by which to decrement all values- Returns:
- RV; this modified vector
- Throws:
ValueRuntimeException
- in case this vector is immutable
-
decrementBy
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:
- RV; this modified vector
- Throws:
ValueRuntimeException
- in case this vector is immutable, when the sizes of the vectors differ, ordecrement
is null
-
multiplyBy
Multiply all values of this vector by the multiplier. This only works if the vector is mutable.- Specified by:
multiplyBy
in interfaceVector.Rel<U extends Unit<U>,S extends AbstractDoubleScalarRel<U,S>,RV extends AbstractDoubleVectorRel<U,S,RV>>
- Parameters:
multiplier
- double; the factor by which to multiply all values- Returns:
- V; this modified vector
-
divideBy
Divide all values of this vector by the divisor. This only works if the vector is mutable.- Specified by:
divideBy
in interfaceVector.Rel<U extends Unit<U>,S extends AbstractDoubleScalarRel<U,S>,RV extends AbstractDoubleVectorRel<U,S,RV>>
- Parameters:
divisor
- double; the value by which to divide all values- Returns:
- V; this modified vector
-
times
public final <UT extends Unit<UT>, ST extends AbstractDoubleScalarRel<UT, ST>, VT extends AbstractDoubleVectorRel<UT, ST, VT> & Relative<UT, VT>> SIVector times(VT rel) throws ValueRuntimeException, UnitExceptionMultiply a Relative value with this Relative value for a vector or matrix. The multiplication is done value by value and store the result in a new Relative value. If both operands are dense, the result is a dense vector or matrix, otherwise the result is a sparse vector or matrix.- Type Parameters:
UT
- the unit type of the multiplierST
- the scalar type of the multiplierVT
- the vector type of the multiplier- Parameters:
rel
- VT; the right operand, which can be any vector type- Returns:
- SIVector; the multiplication of this vector and the operand
- Throws:
ValueRuntimeException
- in case this vector or matrix and the operand have a different sizeUnitException
- on unit error
-
divide
public final <UT extends Unit<UT>, ST extends AbstractDoubleScalarRel<UT, ST>, VT extends AbstractDoubleVectorRel<UT, ST, VT>> SIVector divide(VT rel) throws ValueRuntimeException, UnitExceptionDivide this Relative value by a Relative value for a vector or matrix. The division is done value by value and store the result in a new Relative value. If both operands are dense, the result is a dense vector or matrix, otherwise the result is a sparse vector or matrix.- Type Parameters:
UT
- the unit type of the multiplierST
- the scalar type of the multiplierVT
- the vector type of the multiplier- Parameters:
rel
- VT; the right operand, which can be any vector type- Returns:
- SIVector; the division of this vector and the operand
- Throws:
ValueRuntimeException
- in case this vector or matrix and the operand have a different sizeUnitException
- on unit error
-
times
Returns a new scalar/vector/matrix with value(s) multiplied by a factor. -
divide
Returns a new scalar/vector/matrix with value(s) divided by a factor. -
times
Returns a new scalar/vector/matrix with value(s) multiplied by a factor. -
divide
Returns a new scalar/vector/matrix with value(s) divided by a factor.
-