Fixed Clone
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@118 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
3c29502506
commit
ea37e2f0d2
3 changed files with 13 additions and 4 deletions
|
@ -3,7 +3,7 @@ package jrummikub.model;
|
||||||
import jrummikub.util.Pair;
|
import jrummikub.util.Pair;
|
||||||
|
|
||||||
public interface IStoneTray<E extends Sizeable> extends
|
public interface IStoneTray<E extends Sizeable> extends
|
||||||
Iterable<Pair<E, Position>> {
|
Iterable<Pair<E, Position>>, Cloneable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes object from tray and returns it
|
* Removes object from tray and returns it
|
||||||
|
|
|
@ -225,9 +225,16 @@ public class StoneTray<E extends Sizeable> implements IStoneTray<E> {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public IStoneTray<E> clone() {
|
public IStoneTray<E> clone() {
|
||||||
StoneTray<E> copy = new StoneTray<E>();
|
try {
|
||||||
copy.objects = (HashMap<E, Position>) objects.clone();
|
StoneTray<E> copy = (StoneTray<E>) super.clone();
|
||||||
return copy;
|
copy.objects = (HashMap<E, Position>) objects.clone();
|
||||||
|
|
||||||
|
return copy;
|
||||||
|
} catch (CloneNotSupportedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -21,4 +21,6 @@ public class RoundControlTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue