Allow laying out stone sets
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@180 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
b9fbe279c3
commit
b86571cf83
8 changed files with 209 additions and 125 deletions
|
@ -8,7 +8,7 @@ import jrummikub.util.Pair;
|
|||
|
||||
public class MockHand implements IHand {
|
||||
|
||||
public List<Stone> stones = new ArrayList<Stone>();
|
||||
public List<Pair<Stone, Position>> stones = new ArrayList<Pair<Stone, Position>>();
|
||||
|
||||
public Iterable<Pair<Stone, Position>> iterable;
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class MockHand implements IHand {
|
|||
|
||||
@Override
|
||||
public void drop(Stone object, Position position) {
|
||||
stones.add(object);
|
||||
stones.add(new Pair<Stone, Position>(object, position));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,7 +30,12 @@ public class MockHand implements IHand {
|
|||
|
||||
@Override
|
||||
public void pickUp(Stone object) {
|
||||
stones.remove(object);
|
||||
List<Pair<Stone, Position>> itList = new ArrayList(stones);
|
||||
for (Pair<Stone, Position> entry : itList) {
|
||||
if (entry.getFirst() == object) {
|
||||
stones.remove(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,7 +45,11 @@ public class MockHand implements IHand {
|
|||
|
||||
@Override
|
||||
public Iterator<Pair<Stone, Position>> iterator() {
|
||||
return iterable.iterator();
|
||||
if (iterable != null) {
|
||||
return iterable.iterator();
|
||||
} else {
|
||||
return stones.iterator();
|
||||
}
|
||||
}
|
||||
|
||||
public MockHand clone() {
|
||||
|
|
Reference in a new issue