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().


Fields inherited from class org.apache.xml.dtm.ref.DTMStringPool
NULL
 
Constructor Summary
DTMSafeStringPool()
           
 
Method Summary
 java.lang.String indexToString(int i)
           
static void main(java.lang.String[] args)
          Command-line unit test driver.
 void removeAllElements()
           
 int stringToIndex(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DTMSafeStringPool

public DTMSafeStringPool()
Method Detail

removeAllElements

public void removeAllElements()
Overrides:
removeAllElements in class DTMStringPool

indexToString

public java.lang.String indexToString(int i)
                               throws java.lang.ArrayIndexOutOfBoundsException
Returns:
string whose value is uniquely identified by this integer index.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if index doesn't map to a string.
Overrides:
indexToString in class DTMStringPool

stringToIndex

public int stringToIndex(java.lang.String s)
Returns:
integer index uniquely identifying the value of this string.
Overrides:
stringToIndex in class DTMStringPool

main

public static void main(java.lang.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.


Copyright © 2003 Apache XML Project. All Rights Reserved.