diff options
Diffstat (limited to 'src/jrummikub/model/StoneSet.java')
-rw-r--r-- | src/jrummikub/model/StoneSet.java | 21 |
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); } |