public class PrefixPool extends Object
| Modifier and Type | Field and Description |
|---|---|
(package private) Map<String,Integer> |
index |
(package private) String[] |
prefixes |
(package private) int |
used |
| Constructor and Description |
|---|
PrefixPool() |
| Modifier and Type | Method and Description |
|---|---|
void |
condense()
Eliminate unused space, on the assumption that no further prefixes will be added to the pool,
and that subsequent access will be to get the prefix for a code, and not vice versa.
|
String |
getPrefix(int code)
Get the prefix corresponding to a given code
|
int |
obtainPrefixCode(String prefix)
Get the prefix code corresponding to a given prefix, allocating a new code if necessary
|
public int obtainPrefixCode(String prefix)
prefix - the namespace prefix. If empty, the prefix code is always zero.public String getPrefix(int code)
code - the prefix code (which must have been allocated)IllegalArgumentException - if the code has not been allocatedpublic void condense()