summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/model
diff options
context:
space:
mode:
authorIda Massow <massow@informatik.uni-luebeck.de>2011-06-08 16:29:13 +0200
committerIda Massow <massow@informatik.uni-luebeck.de>2011-06-08 16:29:13 +0200
commit3ff911ab930cb87f90307b9a82dafc4d0b5fe305 (patch)
tree5019f591188fd57d07c16a3e03820876f2e08f48 /src/jrummikub/model
parentce1b716e128bef53b140344bf1e58960fa32cba6 (diff)
downloadJRummikub-3ff911ab930cb87f90307b9a82dafc4d0b5fe305.tar
JRummikub-3ff911ab930cb87f90307b9a82dafc4d0b5fe305.zip
man kann speichern und laden, nur nicht während eines laufenden spiels laden
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@386 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/model')
-rw-r--r--src/jrummikub/model/StoneSet.java9
-rw-r--r--src/jrummikub/model/StoneTray.java3
2 files changed, 8 insertions, 4 deletions
diff --git a/src/jrummikub/model/StoneSet.java b/src/jrummikub/model/StoneSet.java
index 0d53b52..1bb0823 100644
--- a/src/jrummikub/model/StoneSet.java
+++ b/src/jrummikub/model/StoneSet.java
@@ -1,5 +1,6 @@
package jrummikub.model;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -11,10 +12,12 @@ import jrummikub.util.Pair;
import static jrummikub.model.StoneSet.Type.*;
/** Class managing {@link Stone}s joined together to form sets */
-public class StoneSet implements Iterable<Stone>, Sizeable {
+public class StoneSet implements Iterable<Stone>, Sizeable, Serializable {
+ private static final long serialVersionUID = -3852631195648599398L;
+
static final float VERTICAL_BORDER = 0.5f;
static final float HORIZONTAL_BORDER = 0.125f;
- private List<Stone> stones;
+ private ArrayList<Stone> stones;
/**
* Create a new single stone stone set
@@ -23,7 +26,7 @@ public class StoneSet implements Iterable<Stone>, Sizeable {
* single stone of the set
*/
public StoneSet(Stone stone) {
- stones = Collections.singletonList(stone);
+ stones = new ArrayList<Stone>(Collections.singletonList(stone));
}
/**
diff --git a/src/jrummikub/model/StoneTray.java b/src/jrummikub/model/StoneTray.java
index b0a824d..8806b1c 100644
--- a/src/jrummikub/model/StoneTray.java
+++ b/src/jrummikub/model/StoneTray.java
@@ -13,8 +13,9 @@ import jrummikub.util.Pair;
* @param <E>
* Type of positioned objects (must implement Sizeable)
*/
-@SuppressWarnings("serial")
public class StoneTray<E extends Sizeable> implements IStoneTray<E> {
+ private static final long serialVersionUID = -6329309928640027222L;
+
protected HashMap<E, Pair<E, Position>> objects = new HashMap<E, Pair<E, Position>>();
/** Possible move directions in case of overlapping Stones/Sets */