public synchronized void add(EventListener listener){
  Class<?> listenerClass=getListenerClass();
  if (!listenerClass.isInstance(listener)) {
    throw new ClassCastException("listener " + listener + " is not "+ "an instance of listener class "+ listenerClass);
  }
  EventListener[] tmp=(EventListener[])Array.newInstance(listenerClass,listenerList.length + 1);
  System.arraycopy(listenerList,0,tmp,0,listenerList.length);
  tmp[listenerList.length]=listener;
  listenerList=tmp;
}

public synchronized void add ( EventListener listener ) { Class < ? > listenerClass = getListenerClass ( ) ; if ( ! listenerClass . isInstance ( listener ) ) { throw new ClassCastException ( "listener " + listener + " is not " + "an instance of listener class " + listenerClass ) ; } EventListener [ ] tmp = ( EventListener [ ] ) Array . newInstance ( listenerClass , listenerList . length + 1 ) ; System . arraycopy ( listenerList , 0 , tmp , 0 , listenerList . length ) ; tmp [ listenerList . length ] = listener ; listenerList = tmp ; }
adds the listener to this aggregate .
