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 voidaddProperties(Map<String,String> props, String propsStr)Add the properties from stringstatic voidaddProperties(Map<String,String> props, Map<String,String> addProps)Add the properties by mutating the propsstatic voidaddProperty(Map<String,String> props, String key, String value)Add a key and value to the propsstatic int[]convertSgfPosToCoord(String pos)static StringgetOrDefault(Map<String,String> props, String key, String defaultValue)Get a value with key, or the default if there is no such keystatic booleanisListProperty(String key)static booleanisMarkupProperty(String key)static booleanload(String filename)static booleanloadFromString(String sgfString)static StringnodeString(String key, String value)Get node string by the key and valuestatic StringpropertiesString(Map<String,String> props)Get properties string by the propsstatic voidsave(Board board, String filename)static StringsaveToString()
-
-
-
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:
-
-