diff options
author | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-06-18 03:23:30 +0200 |
---|---|---|
committer | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-06-18 03:23:30 +0200 |
commit | c50fd5d7016354fbd462078e7ae296e2bc5ed86e (patch) | |
tree | 3c97fc9e4715f80431da29fe6c46cfd83bd4cf7f /mock/jrummikub/control | |
parent | 325802a215562eef9effef943cd8094c0369daaf (diff) | |
download | JRummikub-c50fd5d7016354fbd462078e7ae296e2bc5ed86e.tar JRummikub-c50fd5d7016354fbd462078e7ae296e2bc5ed86e.zip |
Created IConnectionControl and preliminary MockConnectionControl
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@460 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'mock/jrummikub/control')
-rw-r--r-- | mock/jrummikub/control/network/MockConnectionControl.java | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/mock/jrummikub/control/network/MockConnectionControl.java b/mock/jrummikub/control/network/MockConnectionControl.java new file mode 100644 index 0000000..5dec5e2 --- /dev/null +++ b/mock/jrummikub/control/network/MockConnectionControl.java @@ -0,0 +1,147 @@ +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 + + } +} |