org.eclipse.cdt.debug.internal.core
Class ListenerList

java.lang.Object
  extended by org.eclipse.cdt.debug.internal.core.ListenerList

public class ListenerList
extends java.lang.Object

Local version of org.eclipse.jface.util.ListenerList (modified)s


Constructor Summary
ListenerList(int capacity)
          Creates a listener list with the given initial capacity.
 
Method Summary
 void add(java.lang.Object listener)
          Adds a listener to the list.
 java.lang.Object[] getListeners()
          Returns an array containing all the registered listeners.
 void remove(java.lang.Object listener)
          Removes a listener from the list.
 void removeAll()
          Removes all the listeners from the list.
 int size()
          Returns the number of registered listeners
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListenerList

public ListenerList(int capacity)
Creates a listener list with the given initial capacity.

Parameters:
capacity - the number of listeners which this list can initially accept without growing its internal representation; must be at least 1
Method Detail

add

public void add(java.lang.Object listener)
Adds a listener to the list. Has no effect if an identical listener is already registered.

Parameters:
listener - a listener

getListeners

public java.lang.Object[] getListeners()
Returns an array containing all the registered listeners. The resulting array is unaffected by subsequent adds or removes. If there are no listeners registered, the result is an empty array singleton instance (no garbage is created). Use this method when notifying listeners, so that any modifications to the listener list during the notification will have no effect on the notification itself.


remove

public void remove(java.lang.Object listener)
Removes a listener from the list. Has no effect if an identical listener was not already registered.

Parameters:
listener - a listener

removeAll

public void removeAll()
Removes all the listeners from the list.


size

public int size()
Returns the number of registered listeners

Returns:
the number of registered listeners