Q
- The Quantity (unit type, such as Length or Volume) of this parameter.T
- The type of AbstractParamVector.public abstract class AbstractParamVector<Q extends Quantity,T extends AbstractParamVector<Q,T>> extends Vector<Parameter<Q>> implements VectorSpaceNormed<Vector<Parameter<Q>>,Parameter<Q>>, Measurable<Q>, javolution.lang.Realtime
Constructor and Description |
---|
AbstractParamVector() |
Modifier and Type | Method and Description |
---|---|
Parameter<Angle> |
angle(AbstractParamVector that)
Returns the angle between this vector and the specified vector.
|
int |
compareTo(Measurable<Q> that)
Compares the
norm() of this measure with the specified measurable object. |
T |
divide(double divisor)
Returns this vector with each element divided by the specified divisor
(dimensionless).
|
Parameter<?> |
dot(Vector that)
Returns the dot product of this vector with the one specified.
|
double |
doubleValue(Unit<Q> unit)
Returns the value of this measurable stated in the specified unit as a
double . |
abstract T |
fromVector3D(Vector3D<Q> vector)
Return the specified
Vector3D object as a vector of a particular subtype of
this class. |
abstract Unit<Q> |
getUnit()
Returns the unit in which the values in this vector are stated.
|
double |
getValue(int i)
Returns the value of the Parameter in this vector as a
double in the
current units of the specified dimension of this vector. |
long |
longValue(Unit<Q> unit)
Returns the estimated integral value of this measurable stated in the specified
unit as a
long . |
Parameter<Q> |
mag()
Returns the Euclidian norm, magnitude, or length of this vector (square root of the
dot product of this vector and itself).
|
double |
magValue()
Returns the
norm() , magnitude, or length value of this vector. |
abstract T |
minus(Parameter<Q> that)
Subtracts the supplied Parameter from this vector.
|
Parameter<Q> |
norm()
Returns the Euclidian norm, magnitude, or length of this vector (square root of the
dot product of this vector and itself).
|
abstract double |
normValue()
Returns the
norm() , magnitude, or length value of this vector. |
abstract T |
plus(Parameter<Q> that)
Returns the sum of this vector with the parameter specified.
|
abstract T |
times(double k)
Returns the product of this vector with the specified coefficient.
|
abstract <R extends Quantity> |
to(Unit<R> unit)
Returns the equivalent to this vector but stated in the specified unit.
|
double[] |
toArray()
Returns a new Java array that contains the values of the coordinates of this vector in
the current units.
|
double[] |
toArray(double[] array)
Fills the input Java array with the values of the coordinates of this vector in
the current units.
|
abstract Vector3D<Q> |
toVector3D()
Returns a Vector3D representation of this vector if possible.
|
copy, cross, equals, equals, get, getDimension, hashCode, minus, opposite, plus, times, times, toString, toText
times
opposite, plus
public AbstractParamVector()
public abstract Vector3D<Q> toVector3D()
DimensionException
- if this vector has any number of dimensions other than
3.public abstract T fromVector3D(Vector3D<Q> vector) throws ConversionException
Vector3D
object as a vector of a particular subtype of
this class.vector
- The Vector3D
object to be converted to a specific subtype
of this class.Vector3D
object.ConversionException
- if the sub-type can not represent the units used in the
supplied vector.public double getValue(int i)
double
in the
current units of the specified dimension of this vector.i
- the dimension index.i
.java.lang.IndexOutOfBoundsException
- (i < 0) || (i > dimension()-1)
public Parameter<Q> norm()
norm
in interface VectorSpaceNormed<Vector<Parameter<Q extends Quantity>>,Parameter<Q extends Quantity>>
sqrt(this · this)
.public abstract double normValue()
norm()
, magnitude, or length value of this vector.this.norm().getValue()
.public Parameter<Q> mag()
sqrt(this · this)
.public double magValue()
norm()
, magnitude, or length value of this vector.this.norm().doubleValue()
.public abstract T plus(Parameter<Q> that)
that
- the parameter to be added to this vector.this + that
.public abstract T minus(Parameter<Q> that)
that
- the Parameter to be subtracted from this vector.this - that
.public abstract T times(double k)
k
- the coefficient multiplier.this · k
public Parameter<?> dot(Vector that)
that
- the vector multiplier.this · that
DimensionException
- if this.dimension() != that.dimension()
public T divide(double divisor)
divisor
- the divisor.this / divisor
.public Parameter<Angle> angle(AbstractParamVector that)
that
- the vector to which the angle will be determined.acos(this · that)/(norm(this)*norm(that))
public abstract Unit<Q> getUnit()
public abstract <R extends Quantity> AbstractParamVector<R,? extends AbstractParamVector> to(Unit<R> unit)
R
- The Quantity (unit type) of the vector being output.unit
- the unit of the vector to be returned.ConversionException
- if the current model does not allows for conversion to
the specified unit.public double doubleValue(Unit<Q> unit)
double
. This implementation returns the normValue()
stated in
the specified units.doubleValue
in interface Measurable<Q extends Quantity>
unit
- the unit in which this measurable value is stated.double
.public final long longValue(Unit<Q> unit)
long
. This implementation returns the normValue()
stated in the specified units.
Note: This method differs from the Number.longValue()
in the sense
that the closest integer value is returned and an ArithmeticException is raised
instead of a bit truncation in case of overflow (safety critical).
longValue
in interface Measurable<Q extends Quantity>
unit
- the unit in which the measurable value is stated.long
.java.lang.ArithmeticException
- if this quantity cannot be represented as a
long
number in the specified unit.public int compareTo(Measurable<Q> that)
norm()
of this measure with the specified measurable object.compareTo
in interface java.lang.Comparable<Measurable<Q extends Quantity>>
that
- the measure to compare with.ConversionException
- if the current model does not allows for these measure
to be compared.public double[] toArray(double[] array)
array
- An existing array of at least this.getDimension() size that will be
filled with the values from this vector.public double[] toArray()