|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.collection.util.BigUnsortedReadableList
net.rim.device.api.collection.util.BigSortedReadableList
public class BigSortedReadableList
Maintains a large collection of elements in a sorted order.
When building one of these objects, you must pass it a Comparator
object this collection will use to assist in sorting its elements.
| Field Summary |
|---|
| Fields inherited from class net.rim.device.api.collection.util.BigUnsortedReadableList |
|---|
_elements, _lastInsertedUpdated, _lastInsertedUpdatedIndex, _listenerManager |
| Constructor Summary | ||
|---|---|---|
BigSortedReadableList(Comparator comparator)
Constructs a new BigSortedReadableList instance. |
||
BigSortedReadableList(CollectionEventSource sourceCollection,
Comparator comparator)
Constructs a new BigSortedReadableList instance and initialize with source. |
||
| Method Summary | ||
|---|---|---|
protected int |
binarySearch(Object key,
int startIndex,
int endIndex)
Does binary search to locate an element. |
|
protected void |
doAdd(Object element)
Adds an element to this collection without sending an add event. |
|
protected boolean |
doUpdate(Object oldElement,
Object newElement)
Updates an element in this collection without sending an update element. |
|
Comparator |
getComparator()
Retrieves this collection's comparator object. |
|
protected void |
reload(Object collection)
Reloads from another collection. |
|
void |
setComparator(Comparator comparator)
Sets this collection's comparator, and resorts this collection. |
|
protected void |
sort()
Sorts this collection. |
|
| Methods inherited from class net.rim.device.api.collection.util.BigUnsortedReadableList |
|---|
addCollectionListener, doRemove, elementAdded, elementRemoved, elementUpdated, fireElementAdded, fireElementRemoved, fireElementUpdated, fireReset, getAt, getAt, getIndex, insertAt, loadFrom, removeCollectionListener, replaceAt, reset, size |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.rim.device.api.collection.SortableCollection |
|---|
setComparator |
| Methods inherited from interface net.rim.device.api.collection.CollectionListener |
|---|
elementAdded, elementRemoved, elementUpdated, reset |
| Constructor Detail |
|---|
public BigSortedReadableList(Comparator comparator)
comparator - Comparator to use for ordering the elements.
public BigSortedReadableList(CollectionEventSource sourceCollection,
Comparator comparator)
Use this constructor to build a collection that reads its initial contents from another.
sourceCollection - Collection used as the initial source of data for
this collection.comparator - Comparator to use for ordering elements.| Method Detail |
|---|
public Comparator getComparator()
getComparator in interface SortableCollectionpublic void setComparator(Comparator comparator)
comparator - New comparator for sorting this collection.protected void sort()
Subclasses can override this method in order to know when they are being sorted.
protected void reload(Object collection)
Invoke this method to replace this collection's current list of elements with elements from another collection. After reloading, this method sorts this collection.
reload in class BigUnsortedReadableListcollection - Collection to use as source.
protected int binarySearch(Object key,
int startIndex,
int endIndex)
key - Element to locate.startIndex - Position within list at which to start.endIndex - Position after last element to include in search.
ArrayIndexOutOfBoundsException - Thrown if the start and end
indexes are outside the bounds of the array. Note that the method will
not throw an exception when searching for a null argument in an EMPTY list.protected void doAdd(Object element)
This method adds the element in the appropriate, sorted place in this collection.
doAdd in class BigUnsortedReadableListelement - Element to add.
protected boolean doUpdate(Object oldElement,
Object newElement)
Since this method sends no event, the update operation must either
not affect the sort order of this list, or you must synchronize around
this method and an invocation of BigSortedReadableList.sort().
doUpdate in class BigUnsortedReadableListoldElement - Old element to replace.newElement - New element to take old element's place.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2010 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. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.