com.mtp.model
Class Listeners

java.lang.Object
  |
  +--com.mtp.model.Listeners

public class Listeners
extends Object

Nice utility class for everything which must be listenable. Does the WeakReference bit for you. Allows adds/removes during iteration.

Author:
Matthew Pekar

Field Summary
protected  Collection listeners
           
 
Constructor Summary
Listeners()
           
 
Method Summary
 void add(Object o)
           
protected  Collection buildCollection()
           
 boolean contains(Object o)
          Return true if given listener is stored.
 Iterator getFiringIterator()
          Returns an Iterator that can be used to call the appropriate method on each listener.
 int getSize()
           
 void remove(Object o)
          Remove the given listener and any dead references.
protected  void removeDead()
          Remove dead references.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected Collection listeners
Constructor Detail

Listeners

public Listeners()
Method Detail

buildCollection

protected Collection buildCollection()

contains

public boolean contains(Object o)
Return true if given listener is stored.


removeDead

protected void removeDead()
Remove dead references.


getSize

public int getSize()

add

public void add(Object o)

remove

public void remove(Object o)
Remove the given listener and any dead references.


getFiringIterator

public Iterator getFiringIterator()
Returns an Iterator that can be used to call the appropriate method on each listener.



Copyright © 2002 Matthew Pekar. All Rights Reserved.