diff options
Diffstat (limited to 'mock/jrummikub')
-rw-r--r-- | mock/jrummikub/model/MockGameState.java | 9 | ||||
-rw-r--r-- | mock/jrummikub/model/MockHand.java | 10 | ||||
-rw-r--r-- | mock/jrummikub/model/MockPlayer.java | 13 | ||||
-rw-r--r-- | mock/jrummikub/model/MockTable.java | 8 | ||||
-rw-r--r-- | mock/jrummikub/util/MockEvent.java | 8 | ||||
-rw-r--r-- | mock/jrummikub/util/MockEvent1.java | 14 | ||||
-rw-r--r-- | mock/jrummikub/util/MockEvent2.java | 17 | ||||
-rw-r--r-- | mock/jrummikub/view/MockHandPanel.java | 8 | ||||
-rw-r--r-- | mock/jrummikub/view/MockPlayerPanel.java | 7 | ||||
-rw-r--r-- | mock/jrummikub/view/MockStoneCollectionPanel.java | 10 | ||||
-rw-r--r-- | mock/jrummikub/view/MockTablePanel.java | 14 | ||||
-rw-r--r-- | mock/jrummikub/view/MockView.java | 13 |
12 files changed, 112 insertions, 19 deletions
diff --git a/mock/jrummikub/model/MockGameState.java b/mock/jrummikub/model/MockGameState.java index 377bd1d..53e332e 100644 --- a/mock/jrummikub/model/MockGameState.java +++ b/mock/jrummikub/model/MockGameState.java @@ -4,13 +4,22 @@ import java.awt.Color; import java.util.ArrayList; import java.util.List; +/** + * Mock class for {@link GameState} + */ public class MockGameState implements IGameState { + /** */ public MockTable table; + /** */ public ITable setTable; + /** */ public List<MockPlayer> players; + /** */ public int activePlayer; + /** */ public StoneHeap gameHeap; + /** */ public MockGameState() { table = new MockTable(); players = new ArrayList<MockPlayer>(); diff --git a/mock/jrummikub/model/MockHand.java b/mock/jrummikub/model/MockHand.java index f8388d0..dc348c0 100644 --- a/mock/jrummikub/model/MockHand.java +++ b/mock/jrummikub/model/MockHand.java @@ -7,13 +7,15 @@ import java.util.List; import java.util.Set; import jrummikub.util.Pair; - +/** + * Mock class for {@link Hand} + */ public class MockHand implements IHand { - + /** */ public List<Pair<Stone, Position>> stones = new ArrayList<Pair<Stone, Position>>(); - + /** */ public Set<Stone> pickups = new HashSet<Stone>(); - + /** */ public Iterable<Pair<Stone, Position>> iterable; @Override diff --git a/mock/jrummikub/model/MockPlayer.java b/mock/jrummikub/model/MockPlayer.java index 2f573ca..a9fbd80 100644 --- a/mock/jrummikub/model/MockPlayer.java +++ b/mock/jrummikub/model/MockPlayer.java @@ -2,14 +2,21 @@ package jrummikub.model; import java.awt.Color; +/** + * Mock class for {@link Player} + */ public class MockPlayer implements IPlayer { - + /** */ public MockHand hand; + /** */ public String name; + /** */ public Color color; - // private String name; - + /** + * @param name + * @param color + */ public MockPlayer(String name, Color color) { hand = new MockHand(); this.name = name; diff --git a/mock/jrummikub/model/MockTable.java b/mock/jrummikub/model/MockTable.java index f17e5df..0ff041e 100644 --- a/mock/jrummikub/model/MockTable.java +++ b/mock/jrummikub/model/MockTable.java @@ -7,11 +7,17 @@ import java.util.List; import java.util.Map; import jrummikub.util.Pair; - +/** + * Mock class for {@link Table} + */ 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 diff --git a/mock/jrummikub/util/MockEvent.java b/mock/jrummikub/util/MockEvent.java index 65aec9d..3d4c56a 100644 --- a/mock/jrummikub/util/MockEvent.java +++ b/mock/jrummikub/util/MockEvent.java @@ -1,8 +1,11 @@ package jrummikub.util; import java.util.HashSet; - +/** + * Mock class for Events + */ public class MockEvent implements IEvent { + /** */ public HashSet<IListener> listeners = new HashSet<IListener>(); @Override @@ -21,7 +24,8 @@ public class MockEvent implements IEvent { public void remove(IListener listener) { listeners.remove(listener); } - + + /** */ public void emit() { for (IListener listener : listeners) { listener.handle(); diff --git a/mock/jrummikub/util/MockEvent1.java b/mock/jrummikub/util/MockEvent1.java index 94b0257..7b44c88 100644 --- a/mock/jrummikub/util/MockEvent1.java +++ b/mock/jrummikub/util/MockEvent1.java @@ -2,14 +2,21 @@ package jrummikub.util; import java.util.HashSet; +/** + * Mock class for Event1s + * + * @param <T> + * event type + */ public class MockEvent1<T> implements IEvent1<T> { + /** */ public HashSet<IListener1<T>> listeners = new HashSet<IListener1<T>>(); @Override public Connection add(final IListener1<T> listener) { listeners.add(listener); - return new Connection() { - + return new Connection() { + @Override public void remove() { MockEvent1.this.remove(listener); @@ -22,6 +29,9 @@ public class MockEvent1<T> implements IEvent1<T> { listeners.remove(listener); } + /** + * @param value + */ public void emit(T value) { for (IListener1<T> listener : listeners) { listener.handle(value); diff --git a/mock/jrummikub/util/MockEvent2.java b/mock/jrummikub/util/MockEvent2.java index 5aa7b59..38c9686 100644 --- a/mock/jrummikub/util/MockEvent2.java +++ b/mock/jrummikub/util/MockEvent2.java @@ -2,14 +2,23 @@ package jrummikub.util; import java.util.HashSet; +/** + * Mock class for Event2s + * + * @param <T1> + * first event type + * @param <T2> + * second event type + */ public class MockEvent2<T1, T2> implements IEvent2<T1, T2> { + /** */ public HashSet<IListener2<T1, T2>> listeners = new HashSet<IListener2<T1, T2>>(); @Override public Connection add(final IListener2<T1, T2> listener) { listeners.add(listener); - return new Connection() { - + return new Connection() { + @Override public void remove() { MockEvent2.this.remove(listener); @@ -22,6 +31,10 @@ public class MockEvent2<T1, T2> implements IEvent2<T1, T2> { listeners.remove(listener); } + /** + * @param value1 + * @param value2 + */ public void emit(T1 value1, T2 value2) { for (IListener2<T1, T2> listener : listeners) { listener.handle(value1, value2); diff --git a/mock/jrummikub/view/MockHandPanel.java b/mock/jrummikub/view/MockHandPanel.java index cb97ef7..299d50a 100644 --- a/mock/jrummikub/view/MockHandPanel.java +++ b/mock/jrummikub/view/MockHandPanel.java @@ -10,11 +10,17 @@ import jrummikub.util.Event2; import jrummikub.util.IEvent1; import jrummikub.util.IEvent2; import jrummikub.util.Pair; - +/** + * Mock class for HandPanel + */ public class MockHandPanel implements IHandPanel { + /** */ public Event2<Stone, Boolean> stoneClickEvent = new Event2<Stone, Boolean>(); + /** */ public List<Pair<Stone, Position>> stones; + /** */ public Event2<Stone, Boolean> rangeClickEvent = new Event2<Stone, Boolean>(); + /** */ public Event1<Position> clickEvent = new Event1<Position>(); @Override diff --git a/mock/jrummikub/view/MockPlayerPanel.java b/mock/jrummikub/view/MockPlayerPanel.java index 8103c7e..f193fa1 100644 --- a/mock/jrummikub/view/MockPlayerPanel.java +++ b/mock/jrummikub/view/MockPlayerPanel.java @@ -3,10 +3,17 @@ package jrummikub.view; import jrummikub.util.IEvent; import jrummikub.util.MockEvent; +/** + * Mock class for PlayerPanel + */ public class MockPlayerPanel implements IPlayerPanel { + /** */ public MockEvent endTurnEvent = new MockEvent(); + /** */ public MockHandPanel handPanel = new MockHandPanel(); + /** */ public MockEvent sortByGroupsEvent = new MockEvent(); + /** */ public MockEvent sortByRunsEvent = new MockEvent(); @Override diff --git a/mock/jrummikub/view/MockStoneCollectionPanel.java b/mock/jrummikub/view/MockStoneCollectionPanel.java index 70016e5..66eccaa 100644 --- a/mock/jrummikub/view/MockStoneCollectionPanel.java +++ b/mock/jrummikub/view/MockStoneCollectionPanel.java @@ -4,10 +4,14 @@ import jrummikub.model.Stone; import jrummikub.util.Event2; import jrummikub.util.IEvent2; +/** + * Mock class for StoneCollectionPanel + */ public class MockStoneCollectionPanel implements IStoneCollectionPanel { - - public Event2<Stone,Boolean> stoneClickEvent = new Event2<Stone, Boolean>(); - public Event2<Stone,Boolean> setClickEvent = new Event2<Stone, Boolean>(); + /** */ + public Event2<Stone, Boolean> stoneClickEvent = new Event2<Stone, Boolean>(); + /** */ + public Event2<Stone, Boolean> setClickEvent = new Event2<Stone, Boolean>(); @Override public IEvent2<Stone, Boolean> getStoneClickEvent() { diff --git a/mock/jrummikub/view/MockTablePanel.java b/mock/jrummikub/view/MockTablePanel.java index 792b2e7..ca3db6e 100644 --- a/mock/jrummikub/view/MockTablePanel.java +++ b/mock/jrummikub/view/MockTablePanel.java @@ -9,20 +9,34 @@ import jrummikub.util.IEvent1; import jrummikub.util.IEvent2; import jrummikub.util.Pair; +/** + * Mock class for TablePanel + */ 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 Event1<Position> clickEvent = new Event1<Position>(); + /** */ public Event1<StoneSet> leftConnectorClickEvent = new Event1<StoneSet>(); + /** */ public Event1<StoneSet> rightConnectorClickEvent = new Event1<StoneSet>(); + /** */ public MockStoneCollectionPanel stoneCollectionPanel = new MockStoneCollectionPanel(); + /** */ public String leftPlayerName; + /** */ public String topPlayerName; + /** */ public String rightPlayerName; + /** */ public Iterable<Pair<StoneSet, Position>> stoneSets; @Override diff --git a/mock/jrummikub/view/MockView.java b/mock/jrummikub/view/MockView.java index 44b6a78..f0337f3 100644 --- a/mock/jrummikub/view/MockView.java +++ b/mock/jrummikub/view/MockView.java @@ -5,19 +5,30 @@ import java.util.Collection; import jrummikub.model.Stone; import jrummikub.util.IEvent; import jrummikub.util.MockEvent; - +/** + * Mock class for View + */ 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 |