|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdanger.util.SimpleWeakList
danger.util.ActiveList.WeakDelegateList
public static class ActiveList.WeakDelegateList
List of delegates which are held onto weakly. Instances of this
class are used to hold multiple delegates that have been added to a
single list instance. All of the on*() methods call
that same method with the same arguments on each of the delegates in
the list. Note that the SimpleWeakList.add(java.lang.Object) and SimpleWeakList.remove(java.lang.Object) methods
are simply the inherited Object-accepting ones, but
the guts of this class assume that the only things ever added are
appropriate delegates.
| Field Summary | |
|---|---|
protected int |
mIndex
used while iterating |
protected Object |
mItem
used while iterating |
protected Object[] |
mItems
used while iterating |
protected ActiveList |
mList
used while iterating |
protected int |
mOperation
used while iterating |
protected static int |
ON_ITEM_ADDED
|
protected static int |
ON_ITEM_REMOVED
|
protected static int |
ON_ITEM_UPDATED
|
protected static int |
ON_ITEMS_REORDERED
|
protected static int |
ON_RANGE_ADDED
|
protected static int |
ON_RANGE_REMOVED
|
| Constructor Summary | |
|---|---|
ActiveList.WeakDelegateList()
Construct an instance with an initial capacity of 4. |
|
ActiveList.WeakDelegateList(int initialCapacity)
Construct an instance. |
|
| Method Summary | |
|---|---|
protected void |
accept(Object obj)
Do the operation for a delegate. |
ActiveList.Delegate |
getDelegate(int n)
Get the nth delegate in the list, which may turn
out to be a reaped reference. |
void |
onItemAdded(ActiveList list,
Object item,
int index)
This method is called whenever an item is added to an ActiveList instance. |
void |
onItemRemoved(ActiveList list,
Object item,
int index)
This method is called whenever an individual item is removed from an ActiveList instance. |
void |
onItemsReordered(ActiveList list)
This method is called whenever items get reordered in an ActiveList instance. |
void |
onItemUpdated(ActiveList list,
Object item,
int index)
This method is called whenever an item is updated. |
void |
onRangeAdded(ActiveList list,
Object[] items,
int start)
This method is called whenever a contiguous range of items is added to an ActiveList instance. |
void |
onRangeRemoved(ActiveList list,
Object[] items,
int start)
This method is called whenever a range of items is removed from an ActiveList instance. |
| Methods inherited from class danger.util.SimpleWeakList |
|---|
accept, add, contains, forEachAccept, forEachAccept, get, matchesTarget, remove, size |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int ON_ITEM_UPDATED
protected static final int ON_ITEM_ADDED
protected static final int ON_ITEM_REMOVED
protected static final int ON_RANGE_ADDED
protected static final int ON_RANGE_REMOVED
protected static final int ON_ITEMS_REORDERED
protected int mOperation
protected ActiveList mList
protected Object mItem
protected Object[] mItems
protected int mIndex
| Constructor Detail |
|---|
public ActiveList.WeakDelegateList(int initialCapacity)
initialCapacity - initial capacity of the list; it will
expand as neededpublic ActiveList.WeakDelegateList()
4.
| Method Detail |
|---|
public final ActiveList.Delegate getDelegate(int n)
nth delegate in the list, which may turn
out to be a reaped reference.
n - which element to get
nth delegate, or null
if it was reaped
public final void onItemUpdated(ActiveList list,
Object item,
int index)
ActiveList.DelegateActiveList instance notifies this
instance that is was updated via its update mechanism.
onItemUpdated in interface ActiveList.Delegatelist - non-null; the list which was notifieditem - null-ok; the item that was updatedindex - >= 0; the index that the item is at
public final void onItemAdded(ActiveList list,
Object item,
int index)
ActiveList.DelegateActiveList instance.
onItemAdded in interface ActiveList.Delegatelist - non-null; the list which was modifieditem - null-ok; the item that was addedindex - >= 0; the index that the item was added
(inserted) at
public final void onRangeAdded(ActiveList list,
Object[] items,
int start)
ActiveList.DelegateActiveList instance.
onRangeAdded in interface ActiveList.Delegatelist - non-null; the list which was modifieditems - non-null; array containing the items that were addedstart - >= 0; the start index that the range was added
(inserted) at
public final void onItemRemoved(ActiveList list,
Object item,
int index)
ActiveList.DelegateActiveList instance. For example, StdActiveList.removeItem(java.lang.Object) or and StdActiveList.removeItemAt(int) are two concrete methods that remove
individual items from an instance.
onItemRemoved in interface ActiveList.Delegatelist - non-null; the list which was modifieditem - null-ok; the item that was removedindex - >= 0; the index that the item was removed from
public final void onRangeRemoved(ActiveList list,
Object[] items,
int start)
ActiveList.DelegateActiveList instance. For example, StdActiveList.removeRange(int, int) and StdActiveList.removeAllItems()
are two concrete methods that remove ranges of items from an
instance.
onRangeRemoved in interface ActiveList.Delegatelist - non-null; the list which was modifieditems - non-null; array containing the removed itemsstart - >= 0; the start index that the items were
removed frompublic final void onItemsReordered(ActiveList list)
ActiveList.DelegateActiveList instance. For example, StdActiveList.sort(java.util.Comparator) is
a concrete method that reorders the items of an instance.
onItemsReordered in interface ActiveList.Delegatelist - non-null; the list which was modifiedprotected void accept(Object obj)
accept in class SimpleWeakListobj - non-null; the delegate
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||