summaryrefslogtreecommitdiffstats
path: root/test/jrummikub
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-05 13:16:46 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-05 13:16:46 +0200
commit433a0c3561eeaec96c23656a347e38e3a3602597 (patch)
treeb3c019366f6d2486b625eb5209c449d266ed5370 /test/jrummikub
parent1b881c2ac7dc3f765a6efad115ef173f77bd2e33 (diff)
downloadJRummikub-433a0c3561eeaec96c23656a347e38e3a3602597.tar
JRummikub-433a0c3561eeaec96c23656a347e38e3a3602597.zip
Moved mock classes to separate source folder
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@142 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test/jrummikub')
-rw-r--r--test/jrummikub/model/MockGameState.java54
-rw-r--r--test/jrummikub/model/MockHand.java54
-rw-r--r--test/jrummikub/model/MockPlayer.java26
-rw-r--r--test/jrummikub/model/MockTable.java70
-rw-r--r--test/jrummikub/util/MockEvent.java23
-rw-r--r--test/jrummikub/util/MockEvent1.java23
-rw-r--r--test/jrummikub/util/MockEvent2.java23
-rw-r--r--test/jrummikub/view/MockHandPanel.java42
-rw-r--r--test/jrummikub/view/MockPlayerPanel.java39
-rw-r--r--test/jrummikub/view/MockStoneCollectionPanel.java28
-rw-r--r--test/jrummikub/view/MockTablePanel.java89
-rw-r--r--test/jrummikub/view/MockView.java68
12 files changed, 0 insertions, 539 deletions
diff --git a/test/jrummikub/model/MockGameState.java b/test/jrummikub/model/MockGameState.java
deleted file mode 100644
index 102e9fb..0000000
--- a/test/jrummikub/model/MockGameState.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package jrummikub.model;
-
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.List;
-
-public class MockGameState implements IGameState {
- public MockTable table;
- public List<MockPlayer> players;
- public int activePlayer;
- public StoneHeap gameHeap;
-
- public MockGameState() {
- table = new MockTable();
- players = new ArrayList<MockPlayer>();
- players.add(new MockPlayer(Color.red));
- players.add(new MockPlayer(Color.yellow));
- players.add(new MockPlayer(Color.green));
- players.add(new MockPlayer(Color.black));
- activePlayer = 0;
- gameHeap = new StoneHeap();
- }
-
- @Override
- public ITable getTable() {
- return table;
- }
-
- @Override
- public int getPlayerCount() {
- return players.size();
- }
-
- @Override
- public IPlayer getPlayer(int i) {
- return players.get(i);
- }
-
- /** Changes the activePlayer to the next {@link Player} in the list */
- @Override
- public void nextPlayer() {
- activePlayer = (activePlayer + 1) % players.size();
- }
-
- @Override
- public IPlayer getActivePlayer() {
- return players.get(activePlayer);
- }
-
- @Override
- public StoneHeap getGameHeap() {
- return gameHeap;
- }
-}
diff --git a/test/jrummikub/model/MockHand.java b/test/jrummikub/model/MockHand.java
deleted file mode 100644
index 2132ff4..0000000
--- a/test/jrummikub/model/MockHand.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package jrummikub.model;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import jrummikub.util.Pair;
-
-public class MockHand implements IHand {
-
- public List<Stone> stones = new ArrayList<Stone>();
-
- public Iterable<Pair<Stone, Position>> iterable;
-
- @Override
- public Stone pickUp(Position position) {
- return null;
- }
-
- @Override
- public void drop(Stone object, Position position) {
- stones.add(object);
- }
-
- @Override
- public Position getPosition(Stone object) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void pickUp(Stone object) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public int getSize() {
- return stones.size();
- }
-
- @Override
- public Iterator<Pair<Stone, Position>> iterator() {
- return iterable.iterator();
- }
-
- public MockHand clone() {
- try {
- return (MockHand) super.clone();
- } catch (CloneNotSupportedException e) {
- return null;
- }
- }
-}
diff --git a/test/jrummikub/model/MockPlayer.java b/test/jrummikub/model/MockPlayer.java
deleted file mode 100644
index adb9d85..0000000
--- a/test/jrummikub/model/MockPlayer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package jrummikub.model;
-
-import java.awt.Color;
-
-public class MockPlayer implements IPlayer {
-
- public MockHand hand;
- public Color color;
-
- // private String name;
-
- public MockPlayer(Color color) {
- hand = new MockHand();
- this.color = color;
- }
-
- @Override
- public IHand getHand() {
- return hand;
- }
-
- @Override
- public Color getColor() {
- return color;
- }
-}
diff --git a/test/jrummikub/model/MockTable.java b/test/jrummikub/model/MockTable.java
deleted file mode 100644
index 4d7ef1a..0000000
--- a/test/jrummikub/model/MockTable.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package jrummikub.model;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import jrummikub.util.Pair;
-
-public class MockTable implements ITable {
- public Map<Stone, StoneSet> findStoneSet = new HashMap<Stone, StoneSet>();
- public boolean valid = false;
- public MockTable clonedTable;
- public List<Pair<StoneSet, Position>> sets = new ArrayList<Pair<StoneSet, Position>>();
-
- @Override
- public void pickUpStone(Stone stone) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public boolean isValid() {
- return valid;
- }
-
- @Override
- public StoneSet pickUp(Position position) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void drop(StoneSet object, Position position) {
- sets.add(new Pair<StoneSet, Position>(object, position));
- }
-
- @Override
- public Position getPosition(StoneSet object) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void pickUp(StoneSet object) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Iterator<Pair<StoneSet, Position>> iterator() {
- return sets.iterator();
- }
-
- @Override
- public StoneSet findStoneSet(Stone stone) {
- return findStoneSet.get(stone);
- }
-
- public MockTable clone() {
- return clonedTable;
- }
-
- @Override
- public int getSize() {
- return sets.size();
- }
-
-}
diff --git a/test/jrummikub/util/MockEvent.java b/test/jrummikub/util/MockEvent.java
deleted file mode 100644
index 2f0efe5..0000000
--- a/test/jrummikub/util/MockEvent.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package jrummikub.util;
-
-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 remove(IListener listener) {
- listeners.remove(listener);
- }
-
- public void emit() {
- for (IListener listener : listeners) {
- listener.handle();
- }
- }
-}
diff --git a/test/jrummikub/util/MockEvent1.java b/test/jrummikub/util/MockEvent1.java
deleted file mode 100644
index 74cae0f..0000000
--- a/test/jrummikub/util/MockEvent1.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package jrummikub.util;
-
-import java.util.HashSet;
-
-public class MockEvent1<T> implements IEvent1<T> {
- public HashSet<IListener1<T>> listeners = new HashSet<IListener1<T>>();
-
- @Override
- public void add(IListener1<T> listener) {
- listeners.add(listener);
- }
-
- @Override
- public void remove(IListener1<T> listener) {
- listeners.remove(listener);
- }
-
- public void emit(T value) {
- for (IListener1<T> listener : listeners) {
- listener.handle(value);
- }
- }
-}
diff --git a/test/jrummikub/util/MockEvent2.java b/test/jrummikub/util/MockEvent2.java
deleted file mode 100644
index 93e8228..0000000
--- a/test/jrummikub/util/MockEvent2.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package jrummikub.util;
-
-import java.util.HashSet;
-
-public class MockEvent2<T1, T2> implements IEvent2<T1, T2> {
- public HashSet<IListener2<T1, T2>> listeners = new HashSet<IListener2<T1, T2>>();
-
- @Override
- public void add(IListener2<T1, T2> listener) {
- listeners.add(listener);
- }
-
- @Override
- public void remove(IListener2<T1, T2> listener) {
- listeners.remove(listener);
- }
-
- public void emit(T1 value1, T2 value2) {
- for (IListener2<T1, T2> listener : listeners) {
- listener.handle(value1, value2);
- }
- }
-}
diff --git a/test/jrummikub/view/MockHandPanel.java b/test/jrummikub/view/MockHandPanel.java
deleted file mode 100644
index 4fdd58e..0000000
--- a/test/jrummikub/view/MockHandPanel.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package jrummikub.view;
-
-import jrummikub.model.Position;
-import jrummikub.model.Stone;
-import jrummikub.util.Event2;
-import jrummikub.util.IEvent1;
-import jrummikub.util.IEvent2;
-import jrummikub.util.Pair;
-
-public class MockHandPanel implements IHandPanel {
- public Event2<Stone, Boolean> stoneClickEvent = new Event2<Stone, Boolean>();
- public Iterable<Pair<Stone, Position>> stones;
-
- @Override
- public IEvent2<Stone, Boolean> getStoneClickEvent() {
- return stoneClickEvent;
- }
-
- @Override
- public IEvent2<Stone, Boolean> getRangeClickEvent() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public IEvent2<Stone, Boolean> getSetClickEvent() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public IEvent1<Position> getClickEvent() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void setStones(Iterable<Pair<Stone, Position>> stones) {
- this.stones = stones;
- }
-
-}
diff --git a/test/jrummikub/view/MockPlayerPanel.java b/test/jrummikub/view/MockPlayerPanel.java
deleted file mode 100644
index fcf560e..0000000
--- a/test/jrummikub/view/MockPlayerPanel.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package jrummikub.view;
-
-import jrummikub.util.IEvent;
-import jrummikub.util.MockEvent;
-
-public class MockPlayerPanel implements IPlayerPanel {
- public MockEvent endTurnEvent = new MockEvent();
- public MockHandPanel handPanel = new MockHandPanel();
-
- @Override
- public IHandPanel getHandPanel() {
- // TODO Auto-generated method stub
- return handPanel;
- }
-
- @Override
- public void setTimeLeft(int time) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public IEvent getSortByGroupsEvent() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public IEvent getSortByRunsEvent() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public IEvent getEndTurnEvent() {
- return endTurnEvent;
- }
-
-}
diff --git a/test/jrummikub/view/MockStoneCollectionPanel.java b/test/jrummikub/view/MockStoneCollectionPanel.java
deleted file mode 100644
index 70016e5..0000000
--- a/test/jrummikub/view/MockStoneCollectionPanel.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package jrummikub.view;
-
-import jrummikub.model.Stone;
-import jrummikub.util.Event2;
-import jrummikub.util.IEvent2;
-
-public class MockStoneCollectionPanel implements IStoneCollectionPanel {
-
- public Event2<Stone,Boolean> stoneClickEvent = new Event2<Stone, Boolean>();
- public Event2<Stone,Boolean> setClickEvent = new Event2<Stone, Boolean>();
-
- @Override
- public IEvent2<Stone, Boolean> getStoneClickEvent() {
- return stoneClickEvent;
- }
-
- @Override
- public IEvent2<Stone, Boolean> getRangeClickEvent() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public IEvent2<Stone, Boolean> getSetClickEvent() {
- return setClickEvent;
- }
-
-}
diff --git a/test/jrummikub/view/MockTablePanel.java b/test/jrummikub/view/MockTablePanel.java
deleted file mode 100644
index c32946f..0000000
--- a/test/jrummikub/view/MockTablePanel.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package jrummikub.view;
-
-import java.util.Map;
-
-import jrummikub.model.Position;
-import jrummikub.model.Stone;
-import jrummikub.model.StoneSet;
-import jrummikub.util.Event1;
-import jrummikub.util.Event2;
-import jrummikub.util.IEvent1;
-import jrummikub.util.IEvent2;
-import jrummikub.util.Pair;
-
-public class MockTablePanel implements ITablePanel {
-
- public Event2<Stone, Boolean> stoneClickEvent = new Event2<Stone, Boolean>();
- public Event2<Stone, Boolean> setClickEvent = new Event2<Stone, Boolean>();
- public Event2<Stone, Boolean> rangeClickEvent = new Event2<Stone, Boolean>();
-
- public MockStoneCollectionPanel stoneCollectionPanel = new MockStoneCollectionPanel();
- public String leftPlayerName;
- public String topPlayerName;
- public String rightPlayerName;
-
- public Iterable<Pair<StoneSet, Position>> stoneSets;
-
- @Override
- public IEvent2<Stone, Boolean> getStoneClickEvent() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public IEvent2<Stone, Boolean> getRangeClickEvent() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public IEvent2<Stone, Boolean> getSetClickEvent() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public IEvent1<Position> getClickEvent() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void setLeftPlayerName(String playerName) {
- leftPlayerName = playerName;
- }
-
- @Override
- public void setTopPlayerName(String playerName) {
- topPlayerName = playerName;
- }
-
- @Override
- public void setRightPlayerName(String playerName) {
- rightPlayerName = playerName;
- }
-
- @Override
- public void setStoneSets(Iterable<Pair<StoneSet, Position>> stoneSets) {
- this.stoneSets = stoneSets;
- }
-
- @Override
- public IStoneCollectionPanel getStoneCollectionPanel() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Event1<StoneSet> getLeftConnectorClickEvent() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Event1<StoneSet> getRightConnectorClickEvent() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/test/jrummikub/view/MockView.java b/test/jrummikub/view/MockView.java
deleted file mode 100644
index 44b6a78..0000000
--- a/test/jrummikub/view/MockView.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package jrummikub.view;
-
-import java.util.Collection;
-
-import jrummikub.model.Stone;
-import jrummikub.util.IEvent;
-import jrummikub.util.MockEvent;
-
-public class MockView implements IView {
- public MockPlayerPanel playerPanel = new MockPlayerPanel();
- public MockTablePanel tablePanel = new MockTablePanel();
-
- public Collection<Stone> selectedStones;
-
- public String currentPlayerName;
- public boolean displayStartTurnPanel = false;
- public boolean displayWinPanel = false;
-
- public MockEvent startTurnEvent = new MockEvent();
- public MockEvent quitEvent = new MockEvent();
- public MockEvent newGameEvent = new MockEvent();
-
- @Override
- public MockTablePanel getTablePanel() {
- return tablePanel;
- }
-
- @Override
- public MockPlayerPanel getPlayerPanel() {
- return playerPanel;
- }
-
- @Override
- public void setCurrentPlayerName(String playerName) {
- currentPlayerName = playerName;
- }
-
- @Override
- public void setSelectedStones(Collection<Stone> stones) {
- selectedStones = stones;
- }
-
- @Override
- public void enableStartTurnPanel(boolean enable) {
- displayStartTurnPanel = enable;
- }
-
- @Override
- public IEvent getStartTurnEvent() {
- return startTurnEvent;
- }
-
- @Override
- public void enableWinPanel(boolean enable) {
- displayWinPanel = enable;
- }
-
- @Override
- public IEvent getQuitEvent() {
- return quitEvent;
- }
-
- @Override
- public IEvent getNewGameEvent() {
- return newGameEvent;
- }
-
-} \ No newline at end of file