public abstract class AbstractIntegerVector extends AbstractVector<Integer> implements IntegerVector
IntegerVector. IntegerVector implementations need
only implement Vector.length() and IntegerVector.get(int) functionality to be
read-only vectors.| Constructor and Description |
|---|
AbstractIntegerVector() |
| Modifier and Type | Method and Description |
|---|---|
int |
add(int index,
int 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. |
Integer |
getValue(int index)
Returns the value of the vector at the given index as a
Integer. |
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,
int value)
Throws an
UnsupportedOperationException if called (vector is
unmodifiable). |
void |
set(int index,
Number value)
Set the value in the vector (optional operation).
|
int[] |
toArray()
Returns an
int array representing this vector. |
String |
toString()
Returns a string description of the full contents of this vector
|
addclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetpublic int add(int index,
int delta)
UnsupportedOperationException if called (vector is
unmodifiable).add in interface IntegerVectorindex - 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 Integer getValue(int index)
Integer.getValue in interface IntegerVectorgetValue in interface Vector<Integer>index - index to retrieve.public int hashCode()
int.public double magnitude()
public void set(int index,
int value)
UnsupportedOperationException if called (vector is
unmodifiable).set in interface IntegerVectorindex - index to set.value - value to set in the vector.public void set(int index,
Number value)
public int[] toArray()
int array representing this vector. The returned
array will be "safe" in that no changes to the array will be reflected in
the vector, and likewise for changes to to the vector. The caller is
thus free to modify the returned array.toArray in interface IntegerVectorint array of this vector.public String toString()
toString in class AbstractVector<Integer>Copyright © 2012. All Rights Reserved.