|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.itc.irst.tcc.sre.util.SparseVector
public class SparseVector
TO DO
Nested Class Summary | |
---|---|
class |
SparseVector.Entry
|
private class |
SparseVector.VectorIterator
|
Field Summary | |
---|---|
private int |
count
|
private SparseVector.Entry |
head
|
(package private) static org.apache.log4j.Logger |
logger
Define a static logger variable so that it references the Logger instance named SparseVector . |
private int |
size
|
private SparseVector.Entry |
tail
|
Constructor Summary | |
---|---|
SparseVector()
|
Method Summary | |
---|---|
void |
add(int index,
double value)
Inserts the specified element at the specified position in this vector. |
boolean |
check()
|
double |
dotProduct(Vector v)
Returns an iterator over the elements in this vector in proper sequence (optional operation). |
int |
elementCount()
Returns the number of elements in this vector |
boolean |
existsIndex(int index)
Returns a boolean denoting whether this index already exists in the vector. |
private SparseVector.Entry |
find(int index)
Returns the Entry specified by this index |
double |
get(int index)
Returns the element at the specified position in this vector. |
java.util.Iterator |
iterator()
Returns an iterator over the elements in this vector in proper sequence. |
static void |
main(java.lang.String[] args)
|
double |
norm()
Returns the norm of this vector (optional operation). |
void |
normalize()
Normalizes this vector (optional operation). |
void |
set(int index,
double value)
Replaces the element at the specified position in this vectro with the specified element (optional operation). |
int |
size()
Returns the size of this vector. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static org.apache.log4j.Logger logger
SparseVector
.
private SparseVector.Entry head
private SparseVector.Entry tail
private int count
private int size
Constructor Detail |
---|
public SparseVector()
Method Detail |
---|
public void add(int index, double value) throws java.lang.IndexOutOfBoundsException
Vector
add
in interface Vector
index
- index at which the specified element
is to be inserted.value
- value to be inserted.
java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0).public double get(int index) throws java.lang.IndexOutOfBoundsException
Vector
get
in interface Vector
index
- index of element to return.
java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > size()).public boolean existsIndex(int index)
Vector
existsIndex
in interface Vector
index
- index of element to return.
true
if and only if the index exists; false
otherwisepublic void set(int index, double value) throws java.lang.IndexOutOfBoundsException
Vector
set
in interface Vector
index
- index of element to return.value
- value to be inserted.
java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > size()).public int size()
Vector
size
in interface Vector
public int elementCount()
Vector
elementCount
in interface Vector
private SparseVector.Entry find(int index)
Entry
specified by this index
index
- index of element to return.
Entry
if and only if the index exists; null
otherwisepublic java.util.Iterator iterator()
Vector
iterator
in interface Vector
public java.lang.String toString()
toString
in class java.lang.Object
public double dotProduct(Vector v)
Vector
dotProduct
in interface Vector
public double norm()
Vector
norm
in interface Vector
public void normalize()
Vector
normalize
in interface Vector
public boolean check()
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |