Package org.apache.xml.utils
Class StringToStringTable
java.lang.Object
org.apache.xml.utils.StringToStringTable
A very simple lookup table that stores a list of strings, the even
number strings being keys, and the odd number strings being values.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.StringToStringTable
(int blocksize) Construct a StringToStringTable, using the given block size. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Tell if the table contains the given string.final boolean
containsValue
(String val) Tell if the table contains the given string.final String
elementAt
(int i) Get the nth element.final String
Tell if the table contains the given string.final String
getByValue
(String val) Tell if the table contains the given string in the value.final String
getIgnoreCase
(String key) Tell if the table contains the given string.final int
Get the length of the list.final void
Append a string onto the vector.final void
Remove the given string and its value from this table.
-
Constructor Details
-
StringToStringTable
public StringToStringTable()Default constructor. Note that the default block size is very small, for small lists. -
StringToStringTable
public StringToStringTable(int blocksize) Construct a StringToStringTable, using the given block size.- Parameters:
blocksize
- Size of blocks to allocate
-
-
Method Details
-
getLength
public final int getLength()Get the length of the list.- Returns:
- Number of strings in the list
-
put
Append a string onto the vector. The strings go to the even locations in the array and the values in the odd.- Parameters:
key
- String to add to the listvalue
- Value of the string
-
get
Tell if the table contains the given string.- Parameters:
key
- String to look up- Returns:
- return the value of the string or null if not found.
-
remove
Remove the given string and its value from this table.- Parameters:
key
- String to remove from the table
-
getIgnoreCase
Tell if the table contains the given string. Ignore case- Parameters:
key
- String to look up- Returns:
- The value of the string or null if not found
-
getByValue
Tell if the table contains the given string in the value.- Parameters:
val
- Value of the string to look up- Returns:
- the string associated with the given value or null if not found
-
elementAt
Get the nth element.- Parameters:
i
- index of the string to look up.- Returns:
- The string at the given index.
-
contains
Tell if the table contains the given string.- Parameters:
key
- String to look up- Returns:
- True if the given string is in this table
-
containsValue
Tell if the table contains the given string.- Parameters:
val
- value to look up- Returns:
- True if the given value is in the table.
-