|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--net.rim.device.api.collection.util.UnsortedReadableList
|
+--net.rim.device.api.collection.util.SortedReadableList
Maintains a collection of elements in a sorted order.
This collection uses a comparator object (specified at creation time) to sort the items in the list. Every item you add to the list must be recognized as valid by this comparator.
| Constructor Summary | ||
SortedReadableList(CollectionEventSource sourceCollection,
Comparator comparator)
Constructs a new SortedReadableList instance, and initialize its contents from another list. |
||
SortedReadableList(Comparator comparator)
Constructs a new SortedReadableList instance. |
||
| Method Summary | ||
protected void |
doAdd(Object element)
Adds an element to this list without firing an event. |
|
protected boolean |
doUpdate(Object oldElement,
Object newElement)
Update an element in this list without firing an event. |
|
Comparator |
getComparator()
Retreives this collection's comparator. |
|
protected void |
reload(Object collection)
Reload from the given collection and resort. |
|
void |
setComparator(Comparator comparator)
Sets this collection's comparator, and resorts this collection. |
|
void |
sort()
The list is about to be sorted. |
|
| Methods inherited from class net.rim.device.api.collection.util.UnsortedReadableList |
addCollectionListener, doRemove, elementAdded, elementRemoved, elementUpdated, getAt, getAt, getElements, getIndex, getListenerManager, insertAt, loadFrom, removeCollectionListener, reset, setElements, size |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SortedReadableList(CollectionEventSource sourceCollection, Comparator comparator)
This constructor also automatically registers this collection as a listener with the source collection you specify.
sourceCollection - Collection use as source of elements for this list.comparator - Comparator this list will use to sort its elements; may
not be null. Any item added to this list must be recognized as valid by
this comparator.public SortedReadableList(Comparator comparator)
comparator - Comparator this list will use to sort its elements; may
not be null. Any item added to this list must be recognized as valid by
this comaprator.| Method Detail |
protected void doAdd(Object element)
This method adds the new element in the appropriate (sorted) place in the list.
doAdd in class UnsortedReadableListelement - Element to add: the list's comparator must recognize the
new element as valid.protected boolean doUpdate(Object oldElement, Object newElement)
This method replaces an existing element with a new element. If the old element does not exist in this collection, this method does nothing.
If the old element does exist, this method replaces it with the new element, and manages the list so that it's sorted after the replacement.
doUpdate in class UnsortedReadableListoldElement - Element to replace.newElement - New element to replace the old one: the list's
comaprator must recognize the new element as valid.public Comparator getComparator()
protected void reload(Object collection)
reload in class UnsortedReadableListcollection - The source collection from which to reload.public void setComparator(Comparator comparator)
This method also sends a reset event to any collection monitoring this collection's events.
comparator - New comparator to use for sorting this collection.public void sort()
Subclasses can override this method to know when the complete list is getting sorted.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.