diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-05-04 21:40:11 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-05-04 21:40:11 +0200 |
commit | fe019e5eae8d8e740d7620044727988c6d28a423 (patch) | |
tree | 57730f84b89863252cd70cdc59cce1fc20f85196 /test/jrummikub/util/MockEvent.java | |
parent | d559e1707722a4cd04a70185520f31e94ff26b18 (diff) | |
download | JRummikub-fe019e5eae8d8e740d7620044727988c6d28a423.tar JRummikub-fe019e5eae8d8e740d7620044727988c6d28a423.zip |
Make mock events emittable
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@123 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test/jrummikub/util/MockEvent.java')
-rw-r--r-- | test/jrummikub/util/MockEvent.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/test/jrummikub/util/MockEvent.java b/test/jrummikub/util/MockEvent.java index 85f2c28..2f0efe5 100644 --- a/test/jrummikub/util/MockEvent.java +++ b/test/jrummikub/util/MockEvent.java @@ -4,14 +4,20 @@ import java.util.HashSet; public class MockEvent implements IEvent { public HashSet<IListener> listeners = new HashSet<IListener>(); - + + @Override + public void add(IListener listener) { + listeners.add(listener); + } + @Override - public void add(IListener listener) { - listeners.add(listener); - } + public void remove(IListener listener) { + listeners.remove(listener); + } - @Override - public void remove(IListener listener) { - listeners.remove(listener); - } + public void emit() { + for (IListener listener : listeners) { + listener.handle(); + } + } } |