summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/model/StoneSet.java
diff options
context:
space:
mode:
authorBennet Gerlach <bennet_gerlach@web.de>2011-06-21 01:38:42 +0200
committerBennet Gerlach <bennet_gerlach@web.de>2011-06-21 01:38:42 +0200
commitb0a89642b77736ab5032661f60eb3310a0864c30 (patch)
tree369fd184c171086f0790af25675a30d464202c82 /src/jrummikub/model/StoneSet.java
parent0b1151e6af8ce156d4ad5d6153cb5a02e99329d7 (diff)
downloadJRummikub-b0a89642b77736ab5032661f60eb3310a0864c30.tar
JRummikub-b0a89642b77736ab5032661f60eb3310a0864c30.zip
Added Javadoc comments to private methods in the model
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@522 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/model/StoneSet.java')
-rw-r--r--src/jrummikub/model/StoneSet.java45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/jrummikub/model/StoneSet.java b/src/jrummikub/model/StoneSet.java
index 02fd797..7755a3a 100644
--- a/src/jrummikub/model/StoneSet.java
+++ b/src/jrummikub/model/StoneSet.java
@@ -23,7 +23,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable, Serializable {
* Create a new single stone stone set
*
* @param stone
- * single stone of the set
+ * single stone of the set
*/
public StoneSet(Stone stone) {
stones = new ArrayList<Stone>(Collections.singletonList(stone));
@@ -33,7 +33,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable, Serializable {
* Create a stone set from a list of stones
*
* @param stones
- * list of stones to build a set of
+ * list of stones to build a set of
*/
public StoneSet(List<Stone> stones) {
this.stones = new ArrayList<Stone>(stones);
@@ -53,7 +53,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable, Serializable {
* Test for rule conflict within the StoneSet
*
* @param settings
- * GameSettings
+ * GameSettings
*
* @return true when the set is valid according to the rules
*/
@@ -62,13 +62,13 @@ public class StoneSet implements Iterable<Stone>, Sizeable, Serializable {
}
/**
- * Test for rule conflict within the StoneSet and determine whether the set
- * is a group or a run
+ * Test for rule conflict within the StoneSet and determine whether the set is
+ * a group or a run
*
* @param settings
- * GameSettings
+ * GameSettings
*
- * @return GROUP or RUN for valid sets, INVALID otherwise
+ * @return GROUP or RUN for valid sets, INVALID otherwise and the points
*/
public Pair<Type, Integer> classify(GameSettings settings) {
@@ -84,7 +84,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable, Serializable {
}
if (nonJoker == -1) {
- return classifyJokersOnly(settings, nonJoker);
+ return classifyJokersOnly(settings);
}
int runScore = isValidRun(nonJoker, settings);
@@ -99,8 +99,15 @@ public class StoneSet implements Iterable<Stone>, Sizeable, Serializable {
}
}
- private Pair<Type, Integer> classifyJokersOnly(GameSettings settings,
- int nonJoker) {
+ /**
+ * Test for rule conflict within a StoneSet with jokers only and determine
+ * whether the set is a group or a run
+ *
+ * @param settings
+ * the game settings
+ * @return GROUP or RUN for valid sets, INVALID otherwise and the points
+ */
+ private Pair<Type, Integer> classifyJokersOnly(GameSettings settings) {
if (stones.size() > settings.getHighestValue()
&& stones.size() > settings.getStoneColors().size()
&& !settings.isNoLimits()) {
@@ -126,8 +133,10 @@ public class StoneSet implements Iterable<Stone>, Sizeable, Serializable {
* Test for rule conflict within the StoneSet, assuming we have a run
*
* @param referencePosition
- * position of stone used as reference (any non-joker stone)
+ * position of stone used as reference (any non-joker stone)
* @param settings
+ * the game settings
+ * @return the set's points
*/
private int isValidRun(int referencePosition, GameSettings settings) {
StoneColor runColor = stones.get(referencePosition).getColor();
@@ -167,7 +176,12 @@ public class StoneSet implements Iterable<Stone>, Sizeable, Serializable {
/**
* Test for rule conflict within the StoneSet, assuming we have a group
*
+ * @param value
+ * the value of the stones (all have the same in a group)
+ *
* @param settings
+ * the game settings
+ * @return the set's points
*/
private int isValidGroup(int value, GameSettings settings) {
if (stones.size() > settings.getStoneColors().size()) {
@@ -195,7 +209,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable, Serializable {
* Stone Sets
*
* @param position
- * Splitting {@link Position}
+ * Splitting {@link Position}
* @return A pair of StoneSets, one for each split part
*/
public Pair<StoneSet, StoneSet> splitAt(int position) {
@@ -205,8 +219,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable, Serializable {
return new Pair<StoneSet, StoneSet>(this, null);
}
StoneSet firstSet = new StoneSet(stones.subList(0, position));
- StoneSet secondSet = new StoneSet(stones.subList(position,
- stones.size()));
+ StoneSet secondSet = new StoneSet(stones.subList(position, stones.size()));
return new Pair<StoneSet, StoneSet>(firstSet, secondSet);
}
@@ -214,7 +227,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable, Serializable {
* Joins StoneSet to another StoneSet and returns the resulting new StoneSet
*
* @param other
- * StoneSet to be joined to active StoneSet
+ * StoneSet to be joined to active StoneSet
* @return the combined StoneSet
*/
public StoneSet join(StoneSet other) {
@@ -237,7 +250,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable, Serializable {
* Returns the i-th stone of the set (starting with 0)
*
* @param i
- * number of the stone to return
+ * number of the stone to return
* @return the i-th stone
*/
public Stone get(int i) {