|
|||||||||
| 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
Maintains a collection of elements in an unsorted order.
| Constructor Summary | ||
UnsortedReadableList()
Constructs a new UnsortedReadableList instance. |
||
UnsortedReadableList(CollectionEventSource sourceCollection)
Constructs a new UnsortedReadableList using another collection as a source of initial elements. |
||
| Method Summary | ||
void |
addCollectionListener(Object listener)
Registers a listener to receive collection events. |
|
protected void |
doAdd(Object element)
Adds element without sending an event. |
|
protected boolean |
doRemove(Object element)
Removes an element without sending an event. |
|
protected boolean |
doUpdate(Object oldElement,
Object newElement)
Updates an element without sending an event. |
|
void |
elementAdded(Collection collection,
Object element)
Monitored collection has added an element. |
|
void |
elementRemoved(Collection collection,
Object element)
Monitored collection has removed an element. |
|
void |
elementUpdated(Collection collection,
Object oldElement,
Object newElement)
Monitored collection has replaced an existing element with a new one. |
|
Object |
getAt(int index)
Retrieves element by index. |
|
int |
getAt(int index,
int count,
Object[] elements,
int destIndex)
Retrieves range of elements starting at provided index. |
|
protected Object[] |
getElements()
Retrieves all this collection's elements. |
|
int |
getIndex(Object element)
Retrieves index by element. |
|
protected CollectionListenerManager |
getListenerManager()
Retrieves this collection's listener manager. |
|
protected void |
insertAt(int index,
Object element)
Inserts an element by location. |
|
void |
loadFrom(Object collection)
Reload this list using specified collection as source. |
|
protected void |
reload(Object collection)
Reloads from the given collection. |
|
void |
removeCollectionListener(Object listener)
Removes a listener object from the list of those receiving events. |
|
void |
reset(Collection collection)
Monitored collection has changed drastically; reload from this source. |
|
protected void |
setElements(Object[] elements,
int count)
Set the elements in the collection. |
|
int |
size()
Retrieves the number of elements in this collection. |
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public UnsortedReadableList(CollectionEventSource sourceCollection)
This builds a collection using the provided Collection
as an initial source of data (but only if the passed object is a
Collection). In any case, this constructor registers the passed object as
a listener for this collection's events.
sourceCollection - Collection to use as source of initial contents.| Method Detail |
public void addCollectionListener(Object listener)
listener - Object to register as a listener which must implement
CollectionListener or one of its derived interfaces.protected void doAdd(Object element)
element - Element to add.protected boolean doRemove(Object element)
element - Element to remove; if this element doesn't exist within
this collection, thus method does nothing.protected boolean doUpdate(Object oldElement, Object newElement)
oldElement - Old element to replace; if this element doesn't exist
within this colleciton, this method does nothing.newElement - New element to replace the old element.public void elementAdded(Collection collection, Object element)
Adds element to this collection, and sends an element added event to listening collections.
collection - Changed collection.element - Element added to the monitored collection.public void elementRemoved(Collection collection, Object element)
collection - Changed collection.element - Element removed from the monitored collection.public void elementUpdated(Collection collection, Object oldElement, Object newElement)
This method also sends an update event to each listener monitoring this collection for events.
collection - Changed collectionoldElement - Pre-existing element that was replaced.newElement - New element that replaced the pre-existing one.public Object getAt(int index)
index - Index of the element to retrieve.
public int getAt(int index,
int count,
Object[] elements,
int destIndex)
index - Index of first element to retrieve.count - Number of elements to retrieve.Object - array to contain returned elements; this array must have
enough space to hold the nubmer of elements you expect to receive.destIndex - Index within destination array to contain the first
element retrieved (the destination array must therefore be at least
destIndex + count elements long).protected Object[] getElements()
public int getIndex(Object element)
Note: This operation is linear with respect to the number of elements in the list.
element - Element to locate.protected CollectionListenerManager getListenerManager()
protected void insertAt(int index,
Object element)
index - Index at which to place the new element.element - Element to insert.public void loadFrom(Object collection)
This method also sends a reset event to all the collection's monitoring this list for events. If the collection is of the expected type, then this method sends a reset event to this collection's listeners.
collection - New contents for this list; must be a
ReadableSet, a ReadableList, an Object array, or an
Enumeration.protected void reload(Object collection)
collection - New contents for this list; should be a
ReadableSet, a ReadableList, an Object array, or an
Enumeration.public void removeCollectionListener(Object listener)
listener - Collection listener to remove.public void reset(Collection collection)
collection - Changed collection.protected void setElements(Object[] elements, int count)
Note that the array you provide may have more slots than actual element data; for this reason, you must also provide the number of elements passed in the array.
elements - Array containing new elements.count - Number of actual elements in the provided array.IllegalArgumentException - Thrown if the specified number of elements
is greater than the length of the array, or if the specified number of elements is
less than zero.public int size()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2007 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.