Class ToolboxUtil
- java.lang.Object
-
- com.google.blocks.ftcrobotcontroller.util.ToolboxUtil
-
public class ToolboxUtil extends Object
A class that provides utility methods related to the toolbox.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addDualPropertySetters(StringBuilder xmlToolbox, HardwareType hardwareType, String propertyName, String propertyType, String identifier1, String setterValue1, String identifier2, String setterValue2)
Appends dual property setter blocks to the toolbox.static void
addFunctions(StringBuilder xmlToolbox, HardwareType hardwareType, String identifier, Map<String,Map<String,String>> functions)
Appends the function blocks for the givenHardwareType
to the toolbox.static void
addFunctions(StringBuilder xmlToolbox, HardwareType hardwareType, String identifier, Map<String,Map<String,String>> functions, Map<String,String> functionComments, Map<String,String> variableSetters)
Appends the function blocks for the givenHardwareType
to the toolbox.static void
addProperties(StringBuilder xmlToolbox, HardwareType hardwareType, String identifier, Map<String,String> properties, Map<String,String[]> setterValues, Map<String,String> enumBlocks)
Appends the property blocks for the givenHardwareType
to the toolbox.static String
escapeForXml(String s)
static String
makeBooleanShadow(boolean value)
Creates a shadow boolean block with the given value.static String
makeNumberShadow(double n)
Creates a shadow number block with the given number.static String
makeNumberShadow(int n)
Creates a shadow number block with the given number.static String
makeTextShadow(String text)
Creates a shadow text block with the given value.static String
makeTypedEnumBlock(HardwareType hardwareType, String enumType)
Creates an enum block with the givenHardwareType
and enum type.static String
makeTypedEnumShadow(HardwareType hardwareType, String enumType)
Creates a shadow enum block with the givenHardwareType
and enum type.static String
makeTypedEnumShadow(HardwareType hardwareType, String enumType, String fieldName, String fieldValue)
Creates a shadow enum block with the givenHardwareType
, enum type, fieldName, and fieldValue.static String
makeTypedEnumShadow(String blockTypePrefix, String enumType)
Creates a shadow enum block with the given blockTypePrefix and enum type.static String
makeTypedEnumShadow(String blockTypePrefix, String enumType, String fieldName, String fieldValue)
Creates a shadow enum block with the given blockTypePrefix, enum type, fieldName, and fieldValue.static String
makeVariableGetBlock(String t)
Creates a variable get block.
-
-
-
Method Detail
-
makeNumberShadow
public static String makeNumberShadow(int n)
Creates a shadow number block with the given number.
-
makeNumberShadow
public static String makeNumberShadow(double n)
Creates a shadow number block with the given number.
-
makeBooleanShadow
public static String makeBooleanShadow(boolean value)
Creates a shadow boolean block with the given value.
-
makeTextShadow
public static String makeTextShadow(String text)
Creates a shadow text block with the given value.
-
makeTypedEnumBlock
public static String makeTypedEnumBlock(HardwareType hardwareType, String enumType)
Creates an enum block with the givenHardwareType
and enum type.
-
makeTypedEnumShadow
public static String makeTypedEnumShadow(HardwareType hardwareType, String enumType)
Creates a shadow enum block with the givenHardwareType
and enum type.
-
makeTypedEnumShadow
public static String makeTypedEnumShadow(HardwareType hardwareType, String enumType, String fieldName, String fieldValue)
Creates a shadow enum block with the givenHardwareType
, enum type, fieldName, and fieldValue.
-
makeTypedEnumShadow
public static String makeTypedEnumShadow(String blockTypePrefix, String enumType)
Creates a shadow enum block with the given blockTypePrefix and enum type.
-
makeTypedEnumShadow
public static String makeTypedEnumShadow(String blockTypePrefix, String enumType, String fieldName, String fieldValue)
Creates a shadow enum block with the given blockTypePrefix, enum type, fieldName, and fieldValue.
-
makeVariableGetBlock
public static String makeVariableGetBlock(String t)
Creates a variable get block.
-
addDualPropertySetters
public static void addDualPropertySetters(StringBuilder xmlToolbox, HardwareType hardwareType, String propertyName, String propertyType, String identifier1, String setterValue1, String identifier2, String setterValue2)
Appends dual property setter blocks to the toolbox.
-
addProperties
public static void addProperties(StringBuilder xmlToolbox, HardwareType hardwareType, String identifier, Map<String,String> properties, Map<String,String[]> setterValues, Map<String,String> enumBlocks)
Appends the property blocks for the givenHardwareType
to the toolbox.
-
addFunctions
public static void addFunctions(StringBuilder xmlToolbox, HardwareType hardwareType, String identifier, Map<String,Map<String,String>> functions)
Appends the function blocks for the givenHardwareType
to the toolbox.
-
addFunctions
public static void addFunctions(StringBuilder xmlToolbox, HardwareType hardwareType, String identifier, Map<String,Map<String,String>> functions, Map<String,String> functionComments, Map<String,String> variableSetters)
Appends the function blocks for the givenHardwareType
to the toolbox.
-
-