public class DenseIntVector extends AbstractIntegerVector implements Serializable
IntegerVector class whose data is back by an array.| Constructor and Description |
|---|
DenseIntVector(int length)
Creates a new vector of the specified length
|
DenseIntVector(int[] values)
Creates a new vector using the values of the specified array.
|
DenseIntVector(IntegerVector v)
Creates a new vector using the values of the specified vector.
|
| Modifier and Type | Method and Description |
|---|---|
int |
add(int index,
int delta)
Throws an
UnsupportedOperationException if called (vector is
unmodifiable). |
int |
get(int index)
Returns the value of this vector at the given index.
|
int |
length()
Return the size of the
Vector. |
double |
magnitude()
Returns the magnitude of this vector
|
void |
set(int index,
int value)
Throws an
UnsupportedOperationException if called (vector is
unmodifiable). |
equals, getValue, hashCode, set, toArray, toStringaddpublic DenseIntVector(int length)
length - the length of this vectorpublic DenseIntVector(IntegerVector v)
v - the intial values for this vector to havepublic DenseIntVector(int[] values)
values - the intial values for this vector to havepublic int add(int index,
int delta)
UnsupportedOperationException if called (vector is
unmodifiable).add in interface IntegerVectoradd in class AbstractIntegerVectorindex - index to change.delta - the amount to change by.public int get(int index)
get in interface IntegerVectorindex - index to retrieve.public int length()
Vector.public double magnitude()
magnitude in interface Vector<Integer>magnitude in class AbstractIntegerVectorpublic void set(int index,
int value)
UnsupportedOperationException if called (vector is
unmodifiable).set in interface IntegerVectorset in class AbstractIntegerVectorindex - index to set.value - value to set in the vector.Copyright © 2012. All Rights Reserved.