diff options
Diffstat (limited to 'src/jrummikub/model/Hand.java')
-rw-r--r-- | src/jrummikub/model/Hand.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/jrummikub/model/Hand.java b/src/jrummikub/model/Hand.java index 3e6bfeb..1388187 100644 --- a/src/jrummikub/model/Hand.java +++ b/src/jrummikub/model/Hand.java @@ -47,8 +47,8 @@ public class Hand extends StoneTray<Stone> implements IHand { } @Override - protected Pair<Position, Direction> fixInvalidDrop(Stone stone, Position pos, - Direction dir) { + protected Pair<Position, Direction> fixInvalidDrop(Stone stone, + Position pos, Direction dir) { double x = pos.getX(); double y = pos.getY(); @@ -59,9 +59,11 @@ public class Hand extends StoneTray<Stone> implements IHand { return new Pair<Position, Direction>(new Position(0, y), RIGHT); } else { if (getFreeRowSpace((int) y) == 0) { - return new Pair<Position, Direction>(new Position(0, y + 1), RIGHT); + return new Pair<Position, Direction>(new Position(0, y + 1), + RIGHT); } else { - return new Pair<Position, Direction>(new Position(WIDTH - 1, y), LEFT); + return new Pair<Position, Direction>( + new Position(WIDTH - 1, y), LEFT); } } } @@ -99,8 +101,9 @@ public class Hand extends StoneTray<Stone> implements IHand { * Increments the count of a stone in the list of all stones * * @param stones - * all stones and their respective numbers + * all stones and their respective numbers * @param stone + * the start stone */ private static void incrementStoneCount( TreeMap<Pair<Integer, StoneColor>, Integer> stones, @@ -132,7 +135,7 @@ public class Hand extends StoneTray<Stone> implements IHand { * Counts the numbers of stones * * @param stones - * the stones to count + * the stones to count * @return the numbers for all stones */ private static Pair<TreeMap<Pair<Integer, StoneColor>, Integer>, Integer> countStones( @@ -159,7 +162,8 @@ public class Hand extends StoneTray<Stone> implements IHand { public int getIdenticalStoneCount() { List<Stone> stones = new ArrayList<Stone>(); - for (Iterator<Pair<Stone, Position>> iter = this.iterator(); iter.hasNext();) { + for (Iterator<Pair<Stone, Position>> iter = this.iterator(); iter + .hasNext();) { stones.add(iter.next().getFirst()); } |