|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sdsu.util.List | +--sdsu.util.SortedList
A SortedList is a list of objects kept in sorted order. A Comparer object is needed to compare objects in the list, as there is no standard compare operation for objects. Comparer class for standard types are found in the package sdsu.compare. For object types not covered, make a sublclass of sdsu.compare.Comparer;
List
,
Comparer
,
SortedCollection
, Serialized FormConstructor Summary | |
SortedList(Comparer listOrder)
Create a new SortedList using the Comparer object listOrder to define the order on elements. |
|
SortedList(Comparer listOrder,
int initialSize)
Create a new SortedList using the Comparer object listOrder to define the order on elements. |
Method Summary | |
void |
addElement(java.lang.Object elementToAdd)
Adds the specified object in proper location to keep list sorted. |
void |
addElements(java.lang.Object[] elementsToAdd)
Adds the elements of an array to a SortedList. |
void |
addElements(SortedCollection elementsToAdd)
Adds the elements of a SortedCollection to a SortedList. |
void |
addElements(java.util.Vector elementsToAdd)
Adds the elements of a Vector to a SortedList. |
java.lang.Object |
clone()
Clones this list. |
static SortedList |
doubleSorter()
Returns a sortedList object that will sort floats and doubles. |
Comparer |
getComparer()
Returns the comparer object used to order list. |
int |
indexOf(java.lang.Object elem,
int index)
Searches for the specified object, starting at the specified position and returns an index to it. |
void |
insertElementAt(java.lang.Object object,
int index)
Inserts the specified object in the proper location in the sorted list. |
static SortedList |
integerSorter()
Returns a sortedList object that will sort integers. |
void |
resort(Comparer newOrder)
Resorts the list using the new comparer to define the ordering of the elements. |
OrderedCollection |
reversed()
Returns a SortedList with elements in the reverse order from present SortedList |
void |
setElementAt(java.lang.Object object,
int index)
Sets the element at the specified index to be the specified object and resorts the list. |
static SortedList |
stringSorter()
Returns a sortedList object that will sort strings. |
Methods inherited from class sdsu.util.List |
addElement,
addElement,
capacity,
contains,
doubleAt,
elementAt,
elements,
elementsReversed,
ensureCapacity,
firstElement,
fromString,
getMetaData,
indexOf,
intAt,
isEmpty,
lastElement,
lastIndexOf,
lastIndexOf,
load,
load,
removeAllElements,
removeElement,
removeElementAt,
replaceElements,
save,
setMetaData,
setSeparatorChar,
setSize,
setTokenCharacters,
shuffled,
size,
toArray,
toString,
toString,
toVector,
trimToSize |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public SortedList(Comparer listOrder)
public SortedList(Comparer listOrder, int initialSize)
Method Detail |
public static SortedList integerSorter()
public static SortedList doubleSorter()
public static SortedList stringSorter()
public Comparer getComparer()
public void addElement(java.lang.Object elementToAdd)
elementToAdd
- the element to be addedpublic void addElements(SortedCollection elementsToAdd)
elementsToAdd
- the elements to be addedpublic void addElements(java.util.Vector elementsToAdd)
elementsToAdd
- the elements to be addedpublic void addElements(java.lang.Object[] elementsToAdd)
elementsToAdd
- the elements to be addedpublic final int indexOf(java.lang.Object elem, int index)
elem
- the desired elementindex
- the index where to start searchingpublic void insertElementAt(java.lang.Object object, int index)
object
- the element to insertindex
- not usedpublic void setElementAt(java.lang.Object object, int index)
object
- what the element is to be set toindex
- the specified indexpublic OrderedCollection reversed()
public void resort(Comparer newOrder)
public java.lang.Object clone()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |