Tests for dropping on hand
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@206 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
56b75e037a
commit
ce982fcdaf
6 changed files with 78 additions and 10 deletions
|
@ -1,8 +1,10 @@
|
|||
package jrummikub.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import jrummikub.util.Pair;
|
||||
|
||||
|
@ -10,6 +12,8 @@ public class MockHand implements IHand {
|
|||
|
||||
public List<Pair<Stone, Position>> stones = new ArrayList<Pair<Stone, Position>>();
|
||||
|
||||
public Set<Stone> pickups = new HashSet<Stone>();
|
||||
|
||||
public Iterable<Pair<Stone, Position>> iterable;
|
||||
|
||||
@Override
|
||||
|
@ -29,13 +33,16 @@ public class MockHand implements IHand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void pickUp(Stone object) {
|
||||
List<Pair<Stone, Position>> itList = new ArrayList(stones);
|
||||
public boolean pickUp(Stone object) {
|
||||
List<Pair<Stone, Position>> itList = new ArrayList<Pair<Stone, Position>>(stones);
|
||||
for (Pair<Stone, Position> entry : itList) {
|
||||
if (entry.getFirst() == object) {
|
||||
stones.remove(entry);
|
||||
pickups.add(object);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,9 +43,8 @@ public class MockTable implements ITable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void pickUp(StoneSet object) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
public boolean pickUp(StoneSet object) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import jrummikub.model.Position;
|
||||
import jrummikub.model.Stone;
|
||||
import jrummikub.util.Event1;
|
||||
import jrummikub.util.Event2;
|
||||
import jrummikub.util.IEvent1;
|
||||
import jrummikub.util.IEvent2;
|
||||
|
@ -14,6 +15,7 @@ public class MockHandPanel implements IHandPanel {
|
|||
public Event2<Stone, Boolean> stoneClickEvent = new Event2<Stone, Boolean>();
|
||||
public List<Pair<Stone, Position>> stones;
|
||||
public Event2<Stone, Boolean> rangeClickEvent = new Event2<Stone, Boolean>();
|
||||
public Event1<Position> clickEvent = new Event1<Position>();
|
||||
|
||||
@Override
|
||||
public IEvent2<Stone, Boolean> getStoneClickEvent() {
|
||||
|
@ -33,8 +35,7 @@ public class MockHandPanel implements IHandPanel {
|
|||
|
||||
@Override
|
||||
public IEvent1<Position> getClickEvent() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return clickEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Reference in a new issue