From d6c4da62243310b85a82e73e55249de9af7fdb11 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 22 Jun 2011 03:08:37 +0200 Subject: Show in start turn panel if a player has redealed or drawn the last stone git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@570 72836036-5685-4462-b002-a69064685172 --- mock/jrummikub/util/MockEvent.java | 9 +++++---- mock/jrummikub/util/MockEvent1.java | 2 +- mock/jrummikub/util/MockEvent2.java | 3 ++- mock/jrummikub/util/MockEvent3.java | 15 ++++++++------- 4 files changed, 16 insertions(+), 13 deletions(-) (limited to 'mock/jrummikub/util') diff --git a/mock/jrummikub/util/MockEvent.java b/mock/jrummikub/util/MockEvent.java index 3d4c56a..169e1e7 100644 --- a/mock/jrummikub/util/MockEvent.java +++ b/mock/jrummikub/util/MockEvent.java @@ -1,6 +1,7 @@ package jrummikub.util; import java.util.HashSet; + /** * Mock class for Events */ @@ -11,8 +12,8 @@ public class MockEvent implements IEvent { @Override public Connection add(final IListener listener) { listeners.add(listener); - return new Connection() { - + return new Connection() { + @Override public void remove() { MockEvent.this.remove(listener); @@ -24,10 +25,10 @@ public class MockEvent implements IEvent { public void remove(IListener listener) { listeners.remove(listener); } - + /** */ public void emit() { - for (IListener listener : listeners) { + for (IListener listener : new HashSet(listeners)) { listener.handle(); } } diff --git a/mock/jrummikub/util/MockEvent1.java b/mock/jrummikub/util/MockEvent1.java index 955215c..d8e2824 100644 --- a/mock/jrummikub/util/MockEvent1.java +++ b/mock/jrummikub/util/MockEvent1.java @@ -34,7 +34,7 @@ public class MockEvent1 implements IEvent1 { * the event parameter */ public void emit(T value) { - for (IListener1 listener : listeners) { + for (IListener1 listener : new HashSet>(listeners)) { listener.handle(value); } } diff --git a/mock/jrummikub/util/MockEvent2.java b/mock/jrummikub/util/MockEvent2.java index bb4582f..5c25ca4 100644 --- a/mock/jrummikub/util/MockEvent2.java +++ b/mock/jrummikub/util/MockEvent2.java @@ -38,7 +38,8 @@ public class MockEvent2 implements IEvent2 { * the second event parameter */ public void emit(T1 value1, T2 value2) { - for (IListener2 listener : listeners) { + for (IListener2 listener : new HashSet>( + listeners)) { listener.handle(value1, value2); } } diff --git a/mock/jrummikub/util/MockEvent3.java b/mock/jrummikub/util/MockEvent3.java index 62c3ed9..c154ca0 100644 --- a/mock/jrummikub/util/MockEvent3.java +++ b/mock/jrummikub/util/MockEvent3.java @@ -6,11 +6,11 @@ import java.util.HashSet; * Mock class for Event2s * * @param - * first event type + * first event type * @param - * second event type + * second event type * @param - * third event type + * third event type */ public class MockEvent3 implements IEvent3 { /** */ @@ -35,14 +35,15 @@ public class MockEvent3 implements IEvent3 { /** * @param value1 - * the first event parameter + * the first event parameter * @param value2 - * the second event parameter + * the second event parameter * @param value3 - * the third event parameter + * the third event parameter */ public void emit(T1 value1, T2 value2, T3 value3) { - for (IListener3 listener : listeners) { + for (IListener3 listener : new HashSet>( + listeners)) { listener.handle(value1, value2, value3); } } -- cgit v1.2.3