1 16 19 20 package com.sun.org.apache.xml.internal.dtm.ref; 21 import java.util.Hashtable ; 22 23 40 public class CustomStringPool extends DTMStringPool { 41 final Hashtable m_stringToInt = new Hashtable (); 45 public static final int NULL=-1; 46 47 public CustomStringPool() 48 { 49 super(); 50 53 } 56 57 public void removeAllElements() 58 { 59 m_intToString.removeAllElements(); 60 if (m_stringToInt != null) 61 m_stringToInt.clear(); 62 } 63 64 68 public String indexToString(int i) 69 throws java.lang.ArrayIndexOutOfBoundsException 70 { 71 return(String ) m_intToString.elementAt(i); 72 } 73 74 75 public int stringToIndex(String s) 76 { 77 if (s==null) return NULL; 78 Integer iobj=(Integer )m_stringToInt.get(s); 79 if (iobj==null) { 80 m_intToString.addElement(s); 81 iobj=new Integer (m_intToString.size()); 82 m_stringToInt.put(s,iobj); 83 } 84 return iobj.intValue(); 85 } 86 } 87 | Popular Tags |