|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jds.collection.SortedVector
SortedVector - an indexed collection that keeps values ordered; for use with book Classic Data Structures in Java by Timothy A Budd, published by Addison-Wesley, 2001.
Sorted
,
Bag
,
FindMin
,
FindNth
,
SortAlgorithm
, Serialized FormConstructor Summary | |
SortedVector(java.util.Comparator c)
initialize new sorted vector |
|
SortedVector(Indexed v,
java.util.Comparator c)
initialize new sorted vector |
Method Summary | |
void |
addElement(java.lang.Object value)
add a new value to the collection |
boolean |
containsElement(java.lang.Object value)
see if collection contains value |
java.util.Enumeration |
elements()
Yields enumerator for collection |
java.lang.Object |
findElement(java.lang.Object obj)
find element that will test equal to value |
java.lang.Object |
findNth(int n)
find nth smallest value in collection |
java.lang.Object |
getFirst()
yields the smallest element in collection |
boolean |
isEmpty()
Determines whether the collection is empty |
void |
removeElement(java.lang.Object obj)
remove a new value from the collection |
void |
removeFirst()
removes the smallest element in collection |
int |
size()
Determines number of elements in collection |
void |
sort(Indexed vec)
rearrange collection into asending order |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public SortedVector(Indexed v, java.util.Comparator c)
c
- comparator object used to place values in orderpublic SortedVector(java.util.Comparator c)
c
- comparator object used to place values in orderMethod Detail |
public java.util.Enumeration elements()
Enumeration
that will yield the elements of the collectionEnumeration
public boolean isEmpty()
public int size()
public void addElement(java.lang.Object value)
value
- element to be inserted into collectionpublic java.lang.Object getFirst()
public void removeFirst()
public java.lang.Object findNth(int n)
index
- of value, from 0 to (size-1)
public boolean containsElement(java.lang.Object value)
value
- element to be testedpublic java.lang.Object findElement(java.lang.Object obj)
value
- element to be testedequals
to argumentpublic void removeElement(java.lang.Object obj)
value
- element to be removed from collectionpublic void sort(Indexed vec)
data
- the values to be ordered
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |