org.apache.xml.dtm.ref
Class DTMSafeStringPool
java.lang.Object
org.apache.xml.dtm.ref.DTMStringPool
org.apache.xml.dtm.ref.DTMSafeStringPool
- public class DTMSafeStringPool
- extends DTMStringPool
Like DTMStringPool, but threadsafe. It's been proposed that DTMs
share their string pool(s); that raises threadsafety issues which
this addresses. Of course performance is inferior to that of the
bare-bones version.
Status: Passed basic test in main().
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DTMSafeStringPool
public DTMSafeStringPool()
removeAllElements
public void removeAllElements()
- Overrides:
removeAllElements
in class DTMStringPool
indexToString
public String indexToString(int i)
throws ArrayIndexOutOfBoundsException
- Overrides:
indexToString
in class DTMStringPool
- Returns:
- string whose value is uniquely identified by this integer index.
- Throws:
ArrayIndexOutOfBoundsException
- if index doesn't map to a string.
stringToIndex
public int stringToIndex(String s)
- Overrides:
stringToIndex
in class DTMStringPool
- Returns:
- integer index uniquely identifying the value of this string.
main
public static void main(String[] args)
- Command-line unit test driver. This test relies on the fact that
this version of the pool assigns indices consecutively, starting
from zero, as new unique strings are encountered.