dsto.dfc.collections
Class CompositeList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList
          extended by dsto.dfc.collections.CompositeList
All Implemented Interfaces:
CollectionListener, MonitoredCollection, MonitoredList, Copyable, Disposable, Cloneable, Iterable, Collection, EventListener, List

public class CompositeList
extends AbstractList
implements MonitoredList, CollectionListener, Disposable, Copyable

A virtual list composed of a series of sub-List's laid end to end. Tracks change events on any MonitoredList that is used as a sublist and re-fires the appropriate event.

NOTE: Any sub-list's that may change size after being added must implement MonitoredList or else this class will become out of sync.

Version:
$Revision$
Author:
Matthew Phillips

Field Summary
protected  BasicCollectionEventSource listeners
           
protected  List[] lists
           
protected  int totalSize
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
CompositeList()
           
 
Method Summary
 int absoluteIndex(List list, int index)
           
 void addCollectionListener(CollectionListener l)
           
 void addList(List list)
           
 void addList(List list, int index)
           
 Object clone()
          Create a completely separate copy of this object and any mutable objects owned by the object.
 void dispose()
          Dispose of the object (unregister listeners, close open resources etc).
 void elementsAdded(CollectionEvent e)
           
 void elementsRemoved(CollectionEvent e)
           
 Object get(int index)
           
 int indexOfList(List list)
           
 void removeCollectionListener(CollectionListener l)
           
 void removeList(int index)
           
 int size()
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray
 

Field Detail

lists

protected List[] lists

totalSize

protected int totalSize

listeners

protected BasicCollectionEventSource listeners
Constructor Detail

CompositeList

public CompositeList()
Method Detail

clone

public Object clone()
             throws CloneNotSupportedException
Description copied from interface: Copyable
Create a completely separate copy of this object and any mutable objects owned by the object.

NOTE: subclasses should not remove the CloneNotSupportedException throws clause if they themselves support subclassing: removing the CloneNotSupportedException declaration stops subclasses from indicating that a clone was not possible.

Specified by:
clone in interface Copyable
Overrides:
clone in class Object
Throws:
CloneNotSupportedException - if the clone failed or is not possible.

dispose

public void dispose()
Description copied from interface: Disposable
Dispose of the object (unregister listeners, close open resources etc). It should be safe to call this method more than once. Note for beans that support client event listeners: if there are listeners registered when this is called, this method should do nothing.

Specified by:
dispose in interface Disposable

addList

public void addList(List list)

addList

public void addList(List list,
                    int index)

removeList

public void removeList(int index)

indexOfList

public int indexOfList(List list)

absoluteIndex

public int absoluteIndex(List list,
                         int index)

get

public Object get(int index)
Specified by:
get in interface List
Specified by:
get in class AbstractList

size

public int size()
Specified by:
size in interface Collection
Specified by:
size in interface List
Specified by:
size in class AbstractCollection

addCollectionListener

public void addCollectionListener(CollectionListener l)
Specified by:
addCollectionListener in interface MonitoredCollection

removeCollectionListener

public void removeCollectionListener(CollectionListener l)
Specified by:
removeCollectionListener in interface MonitoredCollection

elementsAdded

public void elementsAdded(CollectionEvent e)
Specified by:
elementsAdded in interface CollectionListener

elementsRemoved

public void elementsRemoved(CollectionEvent e)
Specified by:
elementsRemoved in interface CollectionListener


Copyright © 2008 Commonwealth of Australia