01: package org.cougaar.core.qos.frame.visualizer.util;
02:
03: import java.util.Collection;
04: import java.util.HashMap;
05:
06: /**
07: * Created by IntelliJ IDEA.
08: * User: mwalczak
09: * Date: May 15, 2005
10: * Time: 4:44:12 PM
11: * To change this template use File | Settings | File Templates.
12: */
13: public class SlotChangeListeners {
14:
15: private HashMap listeners;
16:
17: public SlotChangeListeners() {
18: listeners = new HashMap();
19: }
20:
21: public void add(String name, SlotChangeListener l) {
22: listeners.put(name, l);
23: }
24:
25: public SlotChangeListener get(String name) {
26: return getCopy(name);
27: }
28:
29: private SlotChangeListener getCopy(String name) {
30: SlotChangeListener s = (SlotChangeListener) listeners.get(name);
31: if (s != null)
32: return s.cloneInstance();
33: return null;
34: }
35:
36: public Collection getAll() {
37: return listeners.values();
38: }
39: }
|