Q
- The Quantity (unit type) of the elements of this vector.public final class MutableVector<Q extends Quantity> extends GeomVector<Q>
Modified by: Joseph A. Huwaldt
X, Y, Z
RESOURCES
Modifier and Type | Method and Description |
---|---|
MutableVector<Q> |
copy()
Returns a copy of this Vector instance
allocated by the calling thread
(possibly on the stack). |
Vector<Q> |
copyToReal()
Return a copy of this object with any transformations or subranges removed
(applied).
|
Vector<? extends Quantity> |
cross(GeomVector<?> that)
Returns the cross product of two vectors.
|
Vector<Q> |
divide(double divisor)
Returns this vector with each element divided by the specified divisor
(dimensionless).
|
Vector<? extends Quantity> |
divide(Parameter<?> divisor)
Returns this vector with each element divided by the specified divisor.
|
boolean |
equals(java.lang.Object obj)
Compares this vector against the specified object for strict equality (same values
and same units).
|
Point |
getOrigin()
Return the origin point for this vector.
|
int |
getPhyDimension()
Returns the number of physical dimensions of this vector.
|
Unit |
getUnit()
Returns the unit in which the
values in this vector are stated
in. |
double |
getValue(int i)
Returns the value of the Parameter in this vector as a
double , stated
in this vector's unit . |
double |
getValue(int i,
Unit<Q> unit)
Returns the value of the Parameter in this vector as a
double , stated
in the specified units. |
int |
hashCode()
Returns the hash code for this parameter.
|
Vector<Q> |
immutable()
Return an immutable version of this vector.
|
Vector<Q> |
minus(GeomVector<Q> that)
Returns the difference between this vector and the one specified.
|
Vector<Q> |
minus(Parameter<Q> that)
Subtracts the supplied Parameter from each element of this vector and returns the
result.
|
static MutableVector<Dimensionless> |
newInstance(int dim)
Returns a dimensionless
MutableVector instance of the specified
dimension with all the coordinate values set to zero. |
static <Q extends Quantity> |
newInstance(int dim,
Unit<Q> unit)
Returns a
MutableVector instance of the specified dimension and units
with all the coordinate values set to zero. |
double |
normValue()
Returns the
GeomVector.norm() , magnitude, or length value of this vector (square root
of the dot product of this vector and itself). |
Vector<Q> |
opposite()
Returns the negation of this vector.
|
Vector<Q> |
plus(GeomVector<Q> that)
Returns the sum of this vector with the one specified.
|
Vector<Q> |
plus(Parameter<Q> that)
Returns the sum of this vector with the parameter specified.
|
static void |
recycle(MutableVector instance)
Recycles a
MutableVector instance immediately (on the stack when
executing in a StackContext ). |
void |
set(GeomVector<Q> v)
Set the value of elements of this vector to the elements of the specified vector.
|
void |
set(int i,
Parameter<Q> value)
Set the value of a vector dimension to the specified Parameter.
|
void |
setOrigin(Point origin)
Set the origin point for this vector.
|
void |
setValue(int i,
double value)
Set the value of a vector dimension to the specified double in the current vector
units.
|
Vector<Q> |
times(double k)
Returns the product of this vector with the specified coefficient (dimensionless).
|
Parameter<? extends Quantity> |
times(GeomVector<?> that)
Returns the dot product (scalar product) of this vector with the one specified.
|
Vector<? extends Quantity> |
times(Parameter<?> k)
Returns the product of this vector with the specified coefficient.
|
Vector<? extends Quantity> |
timesEBE(GeomVector<?> that)
Returns the element-by-element product of this vector with the one specified.
|
MutableVector |
to(Unit unit)
Returns the equivalent to this vector but stated in the specified unit.
|
MutableVector<Q> |
toDimension(int newDim)
Return a copy of this vector converted to the specified number of physical
dimensions.
|
Float64Vector |
toFloat64Vector()
Returns a
Float64Vector containing the elements of this vector stated
in the current units. |
ParameterVector<Q> |
toParameterVector()
Returns a
ParameterVector representation of this vector. |
Vector<Dimensionless> |
toUnitVector()
Returns this vector converted to a unit vector by dividing all the vector's
elements by the length (
GeomVector.norm() ) of this vector. |
static MutableVector<Dimensionless> |
valueOf(double... x)
Returns a dimensionless
MutableVector instance holding the specified
double value or values. |
static MutableVector<Length> |
valueOf(GeomPoint point)
Returns a
MutableVector instance holding the specified
GeomPoint values. |
static <Q extends Quantity> |
valueOf(GeomVector<Q> vector)
Returns a
Vector instance containing the specified GeomVector values. |
static <Q extends Quantity> |
valueOf(java.util.List<Parameter<Q>> values)
Returns a
MutableVector instance containing the specified list of
Parameter values with compatible units. |
static <Q extends Quantity> |
valueOf(Parameter<Q>... values)
Returns a
MutableVector instance holding the specified
Parameter values. |
static <Q extends Quantity> |
valueOf(Unit<Q> unit,
double... x)
Returns a
MutableVector instance holding the specified
double value or values stated in the specified units. |
static <Q extends Quantity> |
valueOf(Vector<Float64> vector,
Unit<Q> unit)
Returns a
MutableVector instance containing the specified vector of Float64
values stated in the specified units. |
static <Q extends Quantity> |
valueOf(Vector<Parameter<Q>> vector)
Returns a
MutableVector instance containing the specified vector of
Parameter values with compatible units. |
angle, dot, get, getBoundsMax, getBoundsMin, getLimitPoint, getParDimension, getTransformed, isApproxEqual, isApproxEqual, isValid, mag, magValue, norm, size, toArray, toArray, toText
addChangeListener, clone, compareTo, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, reset, setName, toString
addChangeListener, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName
public static MutableVector<Dimensionless> newInstance(int dim)
MutableVector
instance of the specified
dimension with all the coordinate values set to zero.dim
- the physical dimension of the vector to create.public static <Q extends Quantity> MutableVector<Q> newInstance(int dim, Unit<Q> unit)
MutableVector
instance of the specified dimension and units
with all the coordinate values set to zero.Q
- The Quantity (unit type) of the returned vector.dim
- the physical dimension of the vector to create.unit
- the unit in which the coordinates are stated. May not be null.public static <Q extends Quantity> MutableVector<Q> valueOf(GeomVector<Q> vector)
Vector
instance containing the specified GeomVector values.Q
- The Quantity (unit type) of the returned vector.vector
- the GeomVector to be placed in a new Vector instance. May not be null.public static MutableVector<Dimensionless> valueOf(double... x)
MutableVector
instance holding the specified
double
value or values.x
- The dimensionless coordinate values. May not be null.public static <Q extends Quantity> MutableVector<Q> valueOf(Unit<Q> unit, double... x)
MutableVector
instance holding the specified
double
value or values stated in the specified units.Q
- The Quantity (unit type) of the returned vector.unit
- the unit in which the coordinates are stated. May not be null.x
- the coordinate values stated in the specified unit. May not be null.public static <Q extends Quantity> MutableVector<Q> valueOf(Vector<Parameter<Q>> vector)
MutableVector
instance containing the specified vector of
Parameter values with compatible units. All the values are converted to the same
units as the 1st value.Q
- The Quantity (unit type) of the returned vector.vector
- the vector of Parameter values stated in the specified unit. May not
be null.public static <Q extends Quantity> MutableVector<Q> valueOf(java.util.List<Parameter<Q>> values)
MutableVector
instance containing the specified list of
Parameter values with compatible units. All the values are converted to the same
units as the 1st value.Q
- The Quantity (unit type) of the returned vector.values
- the list of Parameter values stated in the specified unit. May not be
null.public static <Q extends Quantity> MutableVector<Q> valueOf(Vector<Float64> vector, Unit<Q> unit)
MutableVector
instance containing the specified vector of Float64
values stated in the specified units.Q
- The Quantity (unit type) of the returned vector.vector
- the vector of Float64 values stated in the specified unit. May not be
null.unit
- the unit in which the coordinates are stated. May not be null.public static <Q extends Quantity> MutableVector<Q> valueOf(Parameter<Q>... values)
MutableVector
instance holding the specified
Parameter
values. All the values are converted to the same units as
the first value.Q
- The Quantity (unit type) of the returned vector.values
- A list of values to store in the vector. May not be null.public static MutableVector<Length> valueOf(GeomPoint point)
MutableVector
instance holding the specified
GeomPoint
values.point
- A point who's coordinates are to be stored in the vector (making it a
position vector). May not be null.public int getPhyDimension()
public void set(int i, Parameter<Q> value)
i
- the dimension index.value
- The new value of the parameter to set at i
. May not be
null.java.lang.IndexOutOfBoundsException
- (i < 0) || (i ≥ getPhyDimension())
public void set(GeomVector<Q> v)
v
- The new vector to make this vector equal to. May not be null.DimensionException
- (v.getPhyDimension() != getPhyDimension())
public void setValue(int i, double value)
i
- the dimension index.value
- The new value of the parameter to set at i
in the current
units of this vector.java.lang.IndexOutOfBoundsException
- (i < 0) || (i ≥ getPhyDimension())
public double getValue(int i)
double
, stated
in this vector's unit
.getValue
in class GeomVector<Q extends Quantity>
i
- the dimension index.i
.java.lang.IndexOutOfBoundsException
- (i < 0) || (i ≥ getPhyDimension())
public double getValue(int i, Unit<Q> unit)
double
, stated
in the specified units.getValue
in class GeomVector<Q extends Quantity>
i
- the dimension index.unit
- the unit to return the value in. May not be null.i
in the specified unit.java.lang.IndexOutOfBoundsException
- (i < 0) || (i ≥ getPhyDimension())
public void setOrigin(Point origin)
setOrigin
in class GeomVector<Q extends Quantity>
origin
- The point to set as the origin of this vector. May not be null.public Point getOrigin()
getOrigin
in class GeomVector<Q extends Quantity>
public double normValue()
GeomVector.norm()
, magnitude, or length value of this vector (square root
of the dot product of this vector and itself).normValue
in class GeomVector<Q extends Quantity>
this.norm().getValue()
.public Vector<Q> opposite()
opposite
in class GeomVector<Q extends Quantity>
-this
.public Vector<Q> plus(GeomVector<Q> that)
plus
in class GeomVector<Q extends Quantity>
that
- the vector to be added. May not be null.this + that
.DimensionException
- if vector dimensions are different.public Vector<Q> plus(Parameter<Q> that)
plus
in class GeomVector<Q extends Quantity>
that
- the parameter to be added to each element of this vector. May not be null.this + that
.public Vector<Q> minus(GeomVector<Q> that)
minus
in class GeomVector<Q extends Quantity>
that
- the vector to be subtracted from this vector. May not be null.this - that
.DimensionException
- if vector dimensions are different.public Vector<Q> minus(Parameter<Q> that)
minus
in class GeomVector<Q extends Quantity>
that
- the Parameter to be subtracted from each element of this vector. May
not be null.this - that
.public Vector<Q> times(double k)
times
in class GeomVector<Q extends Quantity>
k
- the coefficient multiplier.this · k
public Vector<? extends Quantity> times(Parameter<?> k)
times
in class GeomVector<Q extends Quantity>
k
- the coefficient multiplier. May not be null.this · k
public Parameter<? extends Quantity> times(GeomVector<?> that)
times
in class GeomVector<Q extends Quantity>
that
- the vector multiplier. May not be null.this · that
DimensionException
- if this.dimension() != that.dimension()
public Vector<? extends Quantity> timesEBE(GeomVector<?> that)
timesEBE
in class GeomVector<Q extends Quantity>
that
- the vector multiplier. May not be null.this .* that
DimensionException
- if this.dimension() != that.dimension()
public Vector<? extends Quantity> cross(GeomVector<?> that)
cross
in class GeomVector<Q extends Quantity>
that
- the vector multiplier. May not be null.this x that
DimensionException
- if
(that.getDimension() != this.getDimension())
public Vector<Q> divide(double divisor)
divide
in class GeomVector<Q extends Quantity>
divisor
- the divisor.this / divisor
.public Vector<? extends Quantity> divide(Parameter<?> divisor)
divide
in class GeomVector<Q extends Quantity>
divisor
- the divisor. May not be null.this / divisor
.public Vector<Q> immutable()
immutable
in class GeomVector<Q extends Quantity>
public Vector<Dimensionless> toUnitVector()
GeomVector.norm()
) of this vector.toUnitVector
in class GeomVector<Q extends Quantity>
public Unit getUnit()
values
in this vector are stated
in.public MutableVector to(Unit unit) throws ConversionException
unit
- the unit of the vector to be returned. May not be null.ConversionException
- if the the input unit is not compatible with this unit.public MutableVector<Q> toDimension(int newDim)
toDimension
in interface GeomElement<GeomVector>
toDimension
in class GeomVector<Q extends Quantity>
newDim
- The dimension of the vector to return.public MutableVector<Q> copy()
allocated
by the calling thread
(possibly on the stack).copy
in interface GeomElement<GeomVector>
copy
in class GeomVector<Q extends Quantity>
public Vector<Q> copyToReal()
public ParameterVector<Q> toParameterVector()
ParameterVector
representation of this vector.toParameterVector
in class GeomVector<Q extends Quantity>
public Float64Vector toFloat64Vector()
Float64Vector
containing the elements of this vector stated
in the current units.toFloat64Vector
in class GeomVector<Q extends Quantity>
public boolean equals(java.lang.Object obj)
equals
in class AbstractGeomElement<GeomVector>
obj
- the object to compare with.true
if this vector is identical to that vector;
false
otherwise.public int hashCode()
hashCode
in class AbstractGeomElement<GeomVector>
public static void recycle(MutableVector instance)
MutableVector
instance immediately (on the stack when
executing in a StackContext
).instance
- The instance to be recycled.