dsto.dfc.collections
Class BasicMonitoredCollection

java.lang.Object
  extended by dsto.dfc.collections.BasicMonitoredCollection
All Implemented Interfaces:
MonitoredCollection, Copyable, Serializable, Cloneable, Iterable, Collection
Direct Known Subclasses:
BasicMonitoredList, BasicMonitoredSet

public class BasicMonitoredCollection
extends Object
implements MonitoredCollection, Serializable, Copyable

Basic implementation of MonitoredCollection that acts as a wrapper around a Collection instance.

Version:
$Revision$
See Also:
Serialized Form

Nested Class Summary
protected  class BasicMonitoredCollection.CollectionIteratorWrapper
          Wraps an iterator to catch remove () operations.
 
Field Summary
protected  Collection collection
           
protected  ArrayList collectionListeners
           
 
Constructor Summary
BasicMonitoredCollection(Collection collection)
           
 
Method Summary
 boolean add(Object element)
           
 boolean addAll(Collection elements)
           
 void addCollectionListener(CollectionListener l)
           
 void clear()
           
 Object clone()
          Create a completely separate copy of this object and any mutable objects owned by the object.
 boolean contains(Object element)
           
 boolean containsAll(Collection elements)
           
protected  BasicMonitoredCollection emptyClone()
          Make an empty clone of this collection (ie a copy with none of the original elements).
protected  void fireElementsAdded(CollectionEvent e)
           
protected  void fireElementsRemoved(CollectionEvent e)
           
 boolean isEmpty()
           
 Iterator iterator()
           
 boolean remove(Object element)
           
 boolean removeAll(Collection elements)
           
 void removeCollectionListener(CollectionListener l)
           
 boolean retainAll(Collection elements)
           
 int size()
           
 Object[] toArray()
           
 Object[] toArray(Object[] array)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Field Detail

collection

protected Collection collection

collectionListeners

protected transient ArrayList collectionListeners
Constructor Detail

BasicMonitoredCollection

public BasicMonitoredCollection(Collection collection)
Method Detail

add

public boolean add(Object element)
Specified by:
add in interface Collection

remove

public boolean remove(Object element)
Specified by:
remove in interface Collection

addAll

public boolean addAll(Collection elements)
Specified by:
addAll in interface Collection

removeAll

public boolean removeAll(Collection elements)
Specified by:
removeAll in interface Collection

retainAll

public boolean retainAll(Collection elements)
Specified by:
retainAll in interface Collection

clear

public void clear()
Specified by:
clear in interface Collection

size

public int size()
Specified by:
size in interface Collection

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection

contains

public boolean contains(Object element)
Specified by:
contains in interface Collection

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection

toArray

public Object[] toArray(Object[] array)
Specified by:
toArray in interface Collection

containsAll

public boolean containsAll(Collection elements)
Specified by:
containsAll in interface Collection

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.

emptyClone

protected BasicMonitoredCollection emptyClone()
                                       throws CloneNotSupportedException
Make an empty clone of this collection (ie a copy with none of the original elements).

Throws:
CloneNotSupportedException

removeCollectionListener

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

addCollectionListener

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

fireElementsAdded

protected void fireElementsAdded(CollectionEvent e)

fireElementsRemoved

protected void fireElementsRemoved(CollectionEvent e)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008 Commonwealth of Australia