1 15 package hivemind.test.services.impl; 16 17 import hivemind.test.services.ZapEvent; 18 import hivemind.test.services.ZapEventProducer; 19 import hivemind.test.services.ZapListener; 20 21 import java.util.ArrayList ; 22 import java.util.List ; 23 24 29 public class ZapEventProducerImpl implements ZapEventProducer 30 { 31 private List _listeners = new ArrayList (); 32 33 public void addZapListener(ZapListener listener) 34 { 35 _listeners.add(listener); 36 } 37 38 public void removeZapListener(ZapListener listener) 39 { 40 _listeners.remove(listener); 41 } 42 43 public void fireZapDidWiggle(ZapEvent event) 44 { 45 int count = _listeners.size(); 46 for (int i = 0; i < count; i++) 47 { 48 ZapListener l = (ZapListener) _listeners.get(i); 49 50 l.zapDidWiggle(event); 51 } 52 } 53 54 } 55 | Popular Tags |