Package featurecat.lizzie.rules
Class SGFParser
- java.lang.Object
-
- featurecat.lizzie.rules.SGFParser
-
public class SGFParser extends Object
-
-
Constructor Summary
Constructors Constructor Description SGFParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addProperties(Map<String,String> props, String propsStr)
Add the properties from stringstatic void
addProperties(Map<String,String> props, Map<String,String> addProps)
Add the properties by mutating the propsstatic void
addProperty(Map<String,String> props, String key, String value)
Add a key and value to the propsstatic int[]
convertSgfPosToCoord(String pos)
static String
getOrDefault(Map<String,String> props, String key, String defaultValue)
Get a value with key, or the default if there is no such keystatic boolean
isListProperty(String key)
static boolean
isMarkupProperty(String key)
static boolean
load(String filename)
static boolean
loadFromString(String sgfString)
static String
nodeString(String key, String value)
Get node string by the key and valuestatic String
propertiesString(Map<String,String> props)
Get properties string by the propsstatic void
save(Board board, String filename)
static String
saveToString()
-
-
-
Method Detail
-
load
public static boolean load(String filename) throws IOException
- Throws:
IOException
-
loadFromString
public static boolean loadFromString(String sgfString)
-
convertSgfPosToCoord
public static int[] convertSgfPosToCoord(String pos)
-
saveToString
public static String saveToString() throws IOException
- Throws:
IOException
-
save
public static void save(Board board, String filename) throws IOException
- Throws:
IOException
-
isListProperty
public static boolean isListProperty(String key)
-
isMarkupProperty
public static boolean isMarkupProperty(String key)
-
getOrDefault
public static String getOrDefault(Map<String,String> props, String key, String defaultValue)
Get a value with key, or the default if there is no such key- Parameters:
key
-defaultValue
-- Returns:
-
addProperty
public static void addProperty(Map<String,String> props, String key, String value)
Add a key and value to the props- Parameters:
key
-value
-
-
addProperties
public static void addProperties(Map<String,String> props, Map<String,String> addProps)
Add the properties by mutating the props
-
addProperties
public static void addProperties(Map<String,String> props, String propsStr)
Add the properties from string
-
propertiesString
public static String propertiesString(Map<String,String> props)
Get properties string by the props- Returns:
-
-