public abstract class AbstractDoubleVector extends AbstractVector<Double> implements DoubleVector
DoubleVector
. DoubleVector
implementations need
only implement Vector.length()
and DoubleVector.get(int)
functionality to be
read-only vectors.Constructor and Description |
---|
AbstractDoubleVector() |
Modifier and Type | Method and Description |
---|---|
double |
add(int index,
double delta)
Throws an
UnsupportedOperationException if called (vector is
unmodifiable). |
boolean |
equals(Object o)
Returns
true if the object is a Vector of the same length
and whose corresponding indices have equivalent values. |
Double |
getValue(int index)
Returns the value of the vector at the given index as a
Double . |
int |
hashCode()
Returns the hash code as the sum of the vectors elements, normalized to
an
int . |
double |
magnitude()
Returns the magnitude of this vector
|
void |
set(int index,
double value)
Throws an
UnsupportedOperationException if called (vector is
unmodifiable). |
void |
set(int index,
Number value)
Set the value in the vector (optional operation).
|
double[] |
toArray()
Returns a double array representing this vector.
|
String |
toString()
Returns a string description of the full contents of this vector
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
get
public double add(int index, double delta)
UnsupportedOperationException
if called (vector is
unmodifiable).add
in interface DoubleVector
add
in class AbstractVector<Double>
index
- index to change.delta
- the amount to change by.public boolean equals(Object o)
true
if the object is a Vector
of the same length
and whose corresponding indices have equivalent values.public Double getValue(int index)
Double
.getValue
in interface DoubleVector
getValue
in interface Vector<Double>
index
- index to retrieve.public int hashCode()
int
.public double magnitude()
public void set(int index, double value)
UnsupportedOperationException
if called (vector is
unmodifiable).set
in interface DoubleVector
index
- index to set.value
- value to set in the vector.public void set(int index, Number value)
public double[] toArray()
toArray
in interface DoubleVector
double
array of this vector.public String toString()
toString
in class AbstractVector<Double>
Copyright © 2012. All Rights Reserved.