Package repast.simphony.parameter
Class ListTokenizer
java.lang.Object
repast.simphony.parameter.ListTokenizer
Tokenizes lists and ranges of strings, numbers and booleans into
their individual elements.
- Author:
- Nick Collier
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Boolean[]
parseBooleanValues
(String values, String name) Parses a space delimited list of strings into an array of boolean values.static Byte[]
parseByteValues
(String values, String name) Parses a space delimited list of strings into an array of Byte values.static Double[]
parseDoubleValues
(String values, String name) Parses a space delimited list of strings into an array of Double values.static Float[]
parseFloatValues
(String values, String name) Parses a space delimited list of strings into an array of Float values.static Integer[]
parseIntValues
(String values, String name) Parses a space delimited list of strings into an array of Integer values.static Long[]
parseLongValues
(String values, String name) Parses a space delimited list of strings into an array of Long values.static Short[]
parseShortValues
(String values, String name) Parses a space delimited list of strings into an array of Short values.static String[]
parseStringValues
(String values) Parses a space delimited list of strings into an array of individual String values.
-
Constructor Details
-
ListTokenizer
public ListTokenizer()
-
-
Method Details
-
parseBooleanValues
public static Boolean[] parseBooleanValues(String values, String name) throws ParameterFormatException Parses a space delimited list of strings into an array of boolean values. The individual elements must be "true" or "false"- Parameters:
values
- the values to tokenizename
- the name of the parameter- Returns:
- the tokenized list as an array of Booleans
- Throws:
ParameterFormatException
- if there is an error in the tokenization or conversion.
-
parseFloatValues
Parses a space delimited list of strings into an array of Float values. The strings must be valid floats.- Parameters:
values
- the values to tokenizename
- the name of the parameter- Returns:
- the tokenized list as an array of Floats
- Throws:
ParameterFormatException
- if there is an error in the tokenization or conversion.
-
parseLongValues
Parses a space delimited list of strings into an array of Long values. The strings must be valid longs.- Parameters:
values
- the values to tokenizename
- the name of the parameter- Returns:
- the tokenized list as an array of Longs
- Throws:
ParameterFormatException
- if there is an error in the tokenization or conversion.
-
parseDoubleValues
public static Double[] parseDoubleValues(String values, String name) throws ParameterFormatException Parses a space delimited list of strings into an array of Double values. The strings must be valid doubles.- Parameters:
values
- the values to tokenizename
- the name of the parameter- Returns:
- the tokenized list as an array of Doubles
- Throws:
ParameterFormatException
- if there is an error in the tokenization or conversion.
-
parseByteValues
Parses a space delimited list of strings into an array of Byte values. The strings must be valid bytes.- Parameters:
values
- the values to tokenizename
- the name of the parameter- Returns:
- the tokenized list as an array of Bytes
- Throws:
ParameterFormatException
- if there is an error in the tokenization or conversion.
-
parseShortValues
Parses a space delimited list of strings into an array of Short values. The strings must be valid Shorts.- Parameters:
values
- the values to tokenizename
- the name of the parameter- Returns:
- the tokenized list as an array of Shorts
- Throws:
ParameterFormatException
- if there is an error in the tokenization or conversion.
-
parseIntValues
Parses a space delimited list of strings into an array of Integer values. The strings must be valid ints.- Parameters:
values
- the values to tokenizename
- the name of the parameter- Returns:
- the tokenized list as an array of Integers
- Throws:
ParameterFormatException
- if there is an error in the tokenization or conversion.
-
parseStringValues
Parses a space delimited list of strings into an array of individual String values. The strings should be enclosed in single quotes.- Parameters:
values
- the values to tokenize- Returns:
- the tokenized list as an array of Strings
-