diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-06-07 16:59:06 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-06-07 16:59:06 +0200 |
commit | 244abb7e7320355d0c4aad4a7ba267f11d358563 (patch) | |
tree | dd612c5022132d77a9b4f7f1c85f95ce83e2789a /src/jrummikub/model/GameSettings.java | |
parent | af3661fea084df6e089c2597dc4b311c77f39e4f (diff) | |
download | JRummikub-244abb7e7320355d0c4aad4a7ba267f11d358563.tar JRummikub-244abb7e7320355d0c4aad4a7ba267f11d358563.zip |
Make model fully serializable
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@381 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/model/GameSettings.java')
-rw-r--r-- | src/jrummikub/model/GameSettings.java | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/jrummikub/model/GameSettings.java b/src/jrummikub/model/GameSettings.java index 2a8ae0b..671b57c 100644 --- a/src/jrummikub/model/GameSettings.java +++ b/src/jrummikub/model/GameSettings.java @@ -2,6 +2,7 @@ package jrummikub.model; import static jrummikub.model.StoneColor.*; +import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -11,8 +12,10 @@ import java.util.Set; /** * The overall game settings */ -public class GameSettings { - private List<PlayerSettings> players = new ArrayList<PlayerSettings>(); +public class GameSettings implements Serializable { + private static final long serialVersionUID = -7221346125938175643L; + + private ArrayList<PlayerSettings> players = new ArrayList<PlayerSettings>(); private int initialMeldThreshold; private int jokerPoints; @@ -21,7 +24,7 @@ public class GameSettings { private int stoneSetNumber; private int numberOfStonesDealt; private boolean noLimits; - private Set<StoneColor> stoneColors; + private HashSet<StoneColor> stoneColors; /** * Creates new GameSettings with default values @@ -34,8 +37,8 @@ public class GameSettings { stoneSetNumber = 2; numberOfStonesDealt = 14; noLimits = false; - stoneColors = new HashSet<StoneColor>(Arrays.asList(BLACK, BLUE, - ORANGE, RED)); + stoneColors = new HashSet<StoneColor>(Arrays.asList(BLACK, BLUE, ORANGE, + RED)); } /** @@ -51,7 +54,7 @@ public class GameSettings { * Sets the initial meld threshold * * @param value - * the value to set + * the value to set */ public void setInitialMeldThreshold(int value) { initialMeldThreshold = value; @@ -70,7 +73,7 @@ public class GameSettings { * Sets the points counted for a joker * * @param value - * the value to set + * the value to set */ public void setJokerPoints(int value) { jokerPoints = value; @@ -89,7 +92,7 @@ public class GameSettings { * Sets the number of jokers in game * * @param value - * how many jokers will be used + * how many jokers will be used */ public void setJokerNumber(int value) { jokerNumber = value; @@ -117,7 +120,7 @@ public class GameSettings { * Set the highest stone value in use * * @param highestValue - * highest stone value + * highest stone value */ public void setHighestValue(int highestValue) { this.highestValue = highestValue; @@ -136,7 +139,7 @@ public class GameSettings { * Set the number of sets of stones in use * * @param stoneSets - * sets of stones in use + * sets of stones in use */ public void setStoneSetNumber(int stoneSets) { this.stoneSetNumber = stoneSets; @@ -155,7 +158,7 @@ public class GameSettings { * Set whether "No-Limits" rules are used * * @param noLimits - * use no limit rules + * use no limit rules */ public void setNoLimits(boolean noLimits) { this.noLimits = noLimits; @@ -174,10 +177,10 @@ public class GameSettings { * Set stone colors used * * @param stoneColors - * used stone colors + * used stone colors */ public void setStoneColors(Set<StoneColor> stoneColors) { - this.stoneColors = stoneColors; + this.stoneColors = new HashSet<StoneColor>(stoneColors); } /** @@ -193,7 +196,7 @@ public class GameSettings { * Set number of stones dealt at game start * * @param number - * how many Stones will be dealt initially + * how many Stones will be dealt initially */ public void setNumberOfStonesDealt(int number) { numberOfStonesDealt = number; |