summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/model/StoneSet.java
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-02 04:46:00 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-02 04:46:00 +0200
commit1e7cdb33f5bfce2d3fb174abd778788108557078 (patch)
tree7ef56ce60b813402eabff2bc1aee77ba6142cbd8 /src/jrummikub/model/StoneSet.java
parent91b921248f4a74bddd8434bcad65c45fd8486549 (diff)
downloadJRummikub-1e7cdb33f5bfce2d3fb174abd778788108557078.tar
JRummikub-1e7cdb33f5bfce2d3fb174abd778788108557078.zip
More javadocs for the model
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@64 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/model/StoneSet.java')
-rw-r--r--src/jrummikub/model/StoneSet.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/jrummikub/model/StoneSet.java b/src/jrummikub/model/StoneSet.java
index 465692a..d0615fc 100644
--- a/src/jrummikub/model/StoneSet.java
+++ b/src/jrummikub/model/StoneSet.java
@@ -24,7 +24,11 @@ public class StoneSet implements Iterable<Stone>, Sizeable {
this.stones = new ArrayList<Stone>(stones);
}
- /** Test for rule conflict within the StoneSet */
+ /**
+ * Test for rule conflict within the StoneSet
+ *
+ * @return true when the set is valid according to the rules
+ */
public boolean isValid() {
if (stones.size() < 3) {
return false;
@@ -80,6 +84,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable {
}
return true;
}
+
/**
* Test for rule conflict within the StoneSet, assuming we have a group
*/
@@ -107,6 +112,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable {
*
* @param position
* Splitting {@link Position}
+ * @return A pair of StoneSets, one for each split part
*/
public Pair<StoneSet, StoneSet> splitAt(int position) {
// Exception in case of wrong index
@@ -124,6 +130,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable {
*
* @param other
* StoneSet to be joined to active StoneSet
+ * @return the combined StoneSet
*/
public StoneSet join(StoneSet other) {
List<Stone> joinedList = new ArrayList<Stone>();
@@ -132,10 +139,22 @@ public class StoneSet implements Iterable<Stone>, Sizeable {
return new StoneSet(joinedList);
}
+ /**
+ * Returns the number of stones in the set.
+ *
+ * @return number of stones
+ */
public int size() {
return stones.size();
}
+ /**
+ * Returns the i-th stone of the set (starting with 0)
+ *
+ * @param i
+ * number of the stone to return
+ * @return the i-th stone
+ */
public Stone get(int i) {
return stones.get(i);
}