From 85b5470c051e0f5c4de03694e38e40fc1a0a5225 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 10 May 2011 16:53:44 +0200 Subject: Remove return value of Table.pickUpStone() git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@229 72836036-5685-4462-b002-a69064685172 --- mock/jrummikub/model/MockPlayer.java | 4 +++- mock/jrummikub/model/MockTable.java | 3 +-- mock/jrummikub/util/MockEvent1.java | 3 ++- mock/jrummikub/util/MockEvent2.java | 6 ++++-- src/jrummikub/model/ITable.java | 11 +++++------ src/jrummikub/model/Table.java | 12 ++++-------- src/jrummikub/view/impl/WinPanel.java | 2 +- 7 files changed, 20 insertions(+), 21 deletions(-) diff --git a/mock/jrummikub/model/MockPlayer.java b/mock/jrummikub/model/MockPlayer.java index a9fbd80..d9c4a43 100644 --- a/mock/jrummikub/model/MockPlayer.java +++ b/mock/jrummikub/model/MockPlayer.java @@ -15,7 +15,9 @@ public class MockPlayer implements IPlayer { /** * @param name - * @param color + * the player name + * @param color + * the player color */ public MockPlayer(String name, Color color) { hand = new MockHand(); diff --git a/mock/jrummikub/model/MockTable.java b/mock/jrummikub/model/MockTable.java index 39535ec..bfbf8e9 100644 --- a/mock/jrummikub/model/MockTable.java +++ b/mock/jrummikub/model/MockTable.java @@ -22,9 +22,8 @@ public class MockTable implements ITable { public List> sets = new ArrayList>(); @Override - public Pair pickUpStone(Stone stone) { + public void pickUpStone(Stone stone) { // TODO Auto-generated method stub - return null; } @Override diff --git a/mock/jrummikub/util/MockEvent1.java b/mock/jrummikub/util/MockEvent1.java index 7b44c88..955215c 100644 --- a/mock/jrummikub/util/MockEvent1.java +++ b/mock/jrummikub/util/MockEvent1.java @@ -6,7 +6,7 @@ import java.util.HashSet; * Mock class for Event1s * * @param - * event type + * event type */ public class MockEvent1 implements IEvent1 { /** */ @@ -31,6 +31,7 @@ public class MockEvent1 implements IEvent1 { /** * @param value + * the event parameter */ public void emit(T value) { for (IListener1 listener : listeners) { diff --git a/mock/jrummikub/util/MockEvent2.java b/mock/jrummikub/util/MockEvent2.java index 38c9686..bb4582f 100644 --- a/mock/jrummikub/util/MockEvent2.java +++ b/mock/jrummikub/util/MockEvent2.java @@ -6,9 +6,9 @@ import java.util.HashSet; * Mock class for Event2s * * @param - * first event type + * first event type * @param - * second event type + * second event type */ public class MockEvent2 implements IEvent2 { /** */ @@ -33,7 +33,9 @@ public class MockEvent2 implements IEvent2 { /** * @param value1 + * the first event parameter * @param value2 + * the second event parameter */ public void emit(T1 value1, T2 value2) { for (IListener2 listener : listeners) { diff --git a/src/jrummikub/model/ITable.java b/src/jrummikub/model/ITable.java index 3b0032f..49db963 100644 --- a/src/jrummikub/model/ITable.java +++ b/src/jrummikub/model/ITable.java @@ -1,7 +1,5 @@ package jrummikub.model; -import jrummikub.util.Pair; - /** * Interface for the {@link Table} model */ @@ -11,10 +9,9 @@ public interface ITable extends IStoneTray { * Removes {@link Stone} from the Table * * @param stone - * stone to pick up - * @return the stone sets that are created by taking pickung the the stone + * stone to pick up */ - public Pair pickUpStone(Stone stone); + public void pickUpStone(Stone stone); /** * Tests the Table for rule conflicts by checking all the {@link StoneSet} @@ -25,7 +22,9 @@ public interface ITable extends IStoneTray { /** * Finds the {@link StoneSet} containing the given {@link Stone} - * @param stone stone whose set we're searching + * + * @param stone + * stone whose set we're searching * @return the set containing the stone or null if no set was found */ StoneSet findStoneSet(Stone stone); diff --git a/src/jrummikub/model/Table.java b/src/jrummikub/model/Table.java index 4c84193..f134975 100644 --- a/src/jrummikub/model/Table.java +++ b/src/jrummikub/model/Table.java @@ -25,14 +25,12 @@ public class Table extends StoneTray implements ITable { * stone to pick up */ @Override - public Pair pickUpStone(Stone stone) { + public void pickUpStone(Stone stone) { StoneInfo info = findStoneInfo(stone); - if (info == null) { - return null; + if (info != null) { + splitSet(info.set, info.setPosition, info.stonePosition); } - - return splitSet(info.set, info.setPosition, info.stonePosition); } private StoneInfo findStoneInfo(Stone stone) { @@ -71,7 +69,7 @@ public class Table extends StoneTray implements ITable { return info.set; } - private Pair splitSet(StoneSet set, Position setPosition, + private void splitSet(StoneSet set, Position setPosition, int stonePosition) { pickUp(set); @@ -101,8 +99,6 @@ public class Table extends StoneTray implements ITable { drop(leftSet.join(rightSet), newPosition); } } - - return new Pair(leftSet, rightSet); } /** Tests the Table for rule conflicts by checking all the {@link StoneSet} */ diff --git a/src/jrummikub/view/impl/WinPanel.java b/src/jrummikub/view/impl/WinPanel.java index 8cfe458..07c3535 100644 --- a/src/jrummikub/view/impl/WinPanel.java +++ b/src/jrummikub/view/impl/WinPanel.java @@ -18,7 +18,7 @@ import jrummikub.util.IEvent; * A panel that is displayed when a player has won */ @SuppressWarnings("serial") -public class WinPanel extends JPanel { +class WinPanel extends JPanel { private final static int PANEL_INSET = 15; private final static int PANEL_SEPARATOR = 10; private final static float PANEL_FIRST_LINE_HEIGHT = 0.375f; -- cgit v1.2.3