Package edu.wisc.game.rest
Class ParaSet
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<String,Object>
-
- edu.wisc.game.rest.ParaSet
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,Object>
public class ParaSet extends HashMap<String,Object>
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description Piece.Color[]
colors
String[]
images
Will be set as appropriate if specified in the CSV file "images" columnPiece.Shape[]
shapes
Will be set as appropriate if specified in the CSV file "colors" column
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkColors(ColorMap cm)
Makes sure that this parameter set's color list (used for generating random boards) only contains valid colors (present in the color map)void
checkImages()
void
checkShapes()
Makes sure that this parameter set's shape list (used for generating random boards) only contains valid shapes (for which SVG files exist)double
getClearingThreshold()
String
getColors()
For JSONdouble
getDouble(String key)
double
getDouble(String key, boolean optional, double defaultValue)
String
getImages()
int
getInt(String key)
int
getMaxBoards()
double
getPickCost()
The cost of a pick attempt, in terms of the cost of a move.String
getRuleSetName()
String
getShapes()
boolean
isFeedbackSwitchesFree()
True if the player is not told which pieces are movable.static Piece.Color[]
parseColors(String val)
static String[]
parseImages(String val)
Parses the content of the "images" column.static Piece.Shape[]
parseShapes(String val)
Parses a semicolon-separated list of shapes.boolean
pickCostIsInt()
Is the cost of a pick attempt an integer?-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
-
-
-
Field Detail
-
shapes
public Piece.Shape[] shapes
Will be set as appropriate if specified in the CSV file "colors" column
-
colors
public Piece.Color[] colors
-
images
public String[] images
Will be set as appropriate if specified in the CSV file "images" column
-
-
Method Detail
-
getColors
public String getColors()
For JSON
-
getShapes
public String getShapes()
-
getImages
public String getImages()
-
parseShapes
public static Piece.Shape[] parseShapes(String val) throws IOException
Parses a semicolon-separated list of shapes.- Returns:
- An array of Shape values, or null if val is null or empty.
- Throws:
IOException
- On a parsing problem (invalid shape names)
-
parseColors
public static Piece.Color[] parseColors(String val) throws IOException
- Throws:
IOException
-
parseImages
public static String[] parseImages(String val) throws IOException
Parses the content of the "images" column. It may contain a semicolon-separated list of wildcard expressions.- Throws:
IOException
-
getInt
public int getInt(String key)
-
getDouble
public double getDouble(String key)
-
getDouble
public double getDouble(String key, boolean optional, double defaultValue)
- Parameters:
optional
- If true, this method will not throw an exception, and will return defaultValue, if the parameter is absent in the setdefaultValue
- Only used if optional==true
-
getMaxBoards
public int getMaxBoards()
-
getRuleSetName
public String getRuleSetName()
-
getClearingThreshold
public double getClearingThreshold()
-
getPickCost
public double getPickCost()
The cost of a pick attempt, in terms of the cost of a move. The default is 1.0. An early proposal called this param "pick_cost", but then I realized that Paul had planned for it all along, under a different name.
-
pickCostIsInt
public boolean pickCostIsInt()
Is the cost of a pick attempt an integer?
-
checkColors
public void checkColors(ColorMap cm) throws IOException
Makes sure that this parameter set's color list (used for generating random boards) only contains valid colors (present in the color map)- Throws:
IOException
-
checkShapes
public void checkShapes() throws IOException
Makes sure that this parameter set's shape list (used for generating random boards) only contains valid shapes (for which SVG files exist)- Throws:
IOException
-
checkImages
public void checkImages() throws IOException
- Throws:
IOException
-
isFeedbackSwitchesFree
public boolean isFeedbackSwitchesFree()
True if the player is not told which pieces are movable. (free = no objects are marked with X. Seeking to move an object is counted as some fraction of a move.)
-
-