Package edu.wisc.game.engine
Class AllRuleSets
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<String,RuleSet>
-
- edu.wisc.game.engine.AllRuleSets
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,RuleSet>
public class AllRuleSets extends HashMap<String,RuleSet>
Stores rule sets, and allows lookup by name. FIXME: need a web UI for calling clear() on this table, whenever a new version of the same rule set file is created.- 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>
-
-
Constructor Summary
Constructors Constructor Description AllRuleSets()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clearAll()
Can be used to ensure that the rule sets will be reloadedstatic RuleSet
obtain(String ruleSetName)
static RuleSet
read(File f)
-
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
-
-
-
-
Method Detail
-
read
public static RuleSet read(File f) throws IOException, RuleParseException
- Parameters:
f
- The rule set file. if null is given (for the convenience of the command-line random-board generator), we create an all-permissive rule set.- Throws:
IOException
RuleParseException
-
obtain
public static RuleSet obtain(String ruleSetName) throws IOException, RuleParseException
- Parameters:
ruleSetName
- Either a name with no path or extension (which will be mapped to a rule set file in the tomcat directory), or a full file path name (beginning with a "/" and ending in ".txt").- Throws:
IOException
RuleParseException
-
clearAll
public static void clearAll()
Can be used to ensure that the rule sets will be reloaded
-
-