summaryrefslogtreecommitdiffstats
path: root/mock/jrummikub/util
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-06-22 03:08:37 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-06-22 03:08:37 +0200
commitd6c4da62243310b85a82e73e55249de9af7fdb11 (patch)
treeecdb215533c41a9d6f02c0770ea76a38f8b4867b /mock/jrummikub/util
parent62a55c0a918b1d91338a68ee89211006e11785bf (diff)
downloadJRummikub-d6c4da62243310b85a82e73e55249de9af7fdb11.tar
JRummikub-d6c4da62243310b85a82e73e55249de9af7fdb11.zip
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
Diffstat (limited to 'mock/jrummikub/util')
-rw-r--r--mock/jrummikub/util/MockEvent.java9
-rw-r--r--mock/jrummikub/util/MockEvent1.java2
-rw-r--r--mock/jrummikub/util/MockEvent2.java3
-rw-r--r--mock/jrummikub/util/MockEvent3.java15
4 files changed, 16 insertions, 13 deletions
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<IListener>(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<T> implements IEvent1<T> {
* the event parameter
*/
public void emit(T value) {
- for (IListener1<T> listener : listeners) {
+ for (IListener1<T> listener : new HashSet<IListener1<T>>(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<T1, T2> implements IEvent2<T1, T2> {
* the second event parameter
*/
public void emit(T1 value1, T2 value2) {
- for (IListener2<T1, T2> listener : listeners) {
+ for (IListener2<T1, T2> listener : new HashSet<IListener2<T1, T2>>(
+ 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 <T1>
- * first event type
+ * first event type
* @param <T2>
- * second event type
+ * second event type
* @param <T3>
- * third event type
+ * third event type
*/
public class MockEvent3<T1, T2, T3> implements IEvent3<T1, T2, T3> {
/** */
@@ -35,14 +35,15 @@ public class MockEvent3<T1, T2, T3> implements IEvent3<T1, T2, T3> {
/**
* @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<T1, T2, T3> listener : listeners) {
+ for (IListener3<T1, T2, T3> listener : new HashSet<IListener3<T1, T2, T3>>(
+ listeners)) {
listener.handle(value1, value2, value3);
}
}