summaryrefslogtreecommitdiffstats
path: root/mock/jrummikub/control/network/MockConnectionControl.java
blob: 6ecfe753883b86136e92606e56f0996cb5cbc3fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
package jrummikub.control.network;

import java.awt.Color;
import java.util.UUID;

import jrummikub.util.GameData;
import jrummikub.util.IEvent;
import jrummikub.util.IEvent1;
import jrummikub.util.IEvent2;
import jrummikub.util.MockEvent;
import jrummikub.util.MockEvent1;
import jrummikub.util.MockEvent2;

/** */
public class MockConnectionControl implements IConnectionControl {
	/** */
	public String nickname;
	/** */
	public MockEvent connectedEvent = new MockEvent();
	/** */
	public MockEvent connectionFailedEvent = new MockEvent();
	/** */
	public MockEvent1<GameData> gameOfferEvent = new MockEvent1<GameData>();
	/** */
	public MockEvent1<UUID> gameWithdrawalEvent = new MockEvent1<UUID>();
	/** */
	public MockEvent1<String> gameJoinEvent = new MockEvent1<String>();
	/** */
	public MockEvent1<String> gameLeaveEvent = new MockEvent1<String>();
	/** */
	public MockEvent1<Boolean> gameJoinAckEvent = new MockEvent1<Boolean>();
	/** */
	public MockEvent2<String, Color> changeColorEvent = new MockEvent2<String, Color>();
	/** */
	public GameData currentGame;
	/** */
	public GameData offeredGame;
	/** */
	public boolean connected;
	/** */
	public boolean failOnConnect;

	@Override
	public String getNickname() {
		return nickname;
	}

	@Override
	public void connect() {
		if (failOnConnect) {
			connectionFailedEvent.emit();
		} else {
			connected = true;
			connectedEvent.emit();
		}
	}

	@Override
	public void disconnect() {
		connected = false;
	}

	@Override
	public IEvent getConnectedEvent() {
		return connectedEvent;
	}

	@Override
	public IEvent getConnectionFailedEvent() {
		return connectionFailedEvent;
	}

	@Override
	public IEvent1<GameData> getGameOfferEvent() {
		return gameOfferEvent;
	}

	@Override
	public IEvent1<UUID> getGameWithdrawalEvent() {
		return gameWithdrawalEvent;
	}

	@Override
	public IEvent1<String> getGameJoinEvent() {
		return gameJoinEvent;
	}

	@Override
	public IEvent1<String> getGameLeaveEvent() {
		return gameLeaveEvent;
	}

	@Override
	public IEvent1<Boolean> getGameJoinAckEvent() {
		return gameJoinAckEvent;
	}

	@Override
	public IEvent2<String, Color> getChangeColorEvent() {
		return changeColorEvent;
	}

	@Override
	public void offerGame(GameData data) {
		// TODO Auto-generated method stub
	}

	@Override
	public void withdrawGame() {
		// TODO Auto-generated method stub
	}

	@Override
	public GameData getCurrentGame() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setCurrentGame(GameData game) {
		// TODO Auto-generated method stub

	}

	@Override
	public void joinGame(GameData game) {
		// TODO Auto-generated method stub

	}

	@Override
	public void leaveGame() {
		// TODO Auto-generated method stub

	}

	@Override
	public void ackJoinGame(String recipient, boolean ack) {
		// TODO Auto-generated method stub

	}

	@Override
	public void changeColor(Color color) {
		// TODO Auto-generated method stub

	}
}