|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jds.collection.SparseVector
SparseVector - sparse collection with elements accessible via index; for use with book Classic Data Structures in Java by Timothy A Budd, published by Addison-Wesley, 2001.
Collection
, Serialized FormConstructor Summary | |
SparseVector()
initialize a newly created sparse vector |
|
SparseVector(java.lang.Object d)
initialize a newly created sparse vector |
Method Summary | |
void |
addElementAt(java.lang.Object val,
int index)
add a new element into the collection, making collection one element larger |
java.lang.Object |
elementAt(int indx)
find value at specific index location |
java.util.Enumeration |
elements()
Yields enumerator for collection |
boolean |
isEmpty()
Determines whether the collection is empty |
void |
removeElementAt(int index)
remove a value from a collection, making collection one element smaller |
void |
setElementAt(java.lang.Object v,
int indx)
set value at specific location |
void |
setSize(int size)
set number of elements in collection |
int |
size()
Determines number of elements in collection |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public SparseVector()
public SparseVector(java.lang.Object d)
d
- default value to return for unassigned index positionsMethod Detail |
public boolean isEmpty()
public int size()
public java.util.Enumeration elements()
Enumeration
that will yield the elements of the collectionEnumeration
public void setSize(int size)
size
- the new size of the collectionpublic java.lang.Object elementAt(int indx)
indx
- the index of the desired valuepublic void setElementAt(java.lang.Object v, int indx)
v
- the value to be insertedindex
- the position at which value will be insertedpublic void addElementAt(java.lang.Object val, int index)
val
- the value to be insertedindex
- the position at which value will be inserted, other elements will be moved upwardspublic void removeElementAt(int index)
index
- the index of the element to be removed
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |