/** @return integer index uniquely identifying the value of this string. */ public int stringToIndex(String s) { if(s==null) return NULL; int hashslot=s.hashCode()%HASHPRIME; if(hashslot<0) hashslot=-hashslot; // Is it one we already know? int hashlast=m_hashStart[hashslot]; int hashcandidate=hashlast; while(hashcandidate!=NULL) { if(m_intToString.elementAt(hashcandidate).equals(s)) return hashcandidate; hashlast=hashcandidate; hashcandidate=m_hashChain.elementAt(hashcandidate); } // New value. Add to tables. int newIndex=m_intToString.size(); m_intToString.addElement(s); m_hashChain.addElement(NULL); // Initialize to no-following-same-hash if(hashlast==NULL) // First for this hash m_hashStart[hashslot]=newIndex; else // Link from previous with same hash m_hashChain.setElementAt(newIndex,hashlast); return newIndex; }
/** @return integer index uniquely identifying the value of this string. */ public int stringToIndex(String s) { if(s==null) return NULL; int hashslot=s.hashCode()%HASHPRIME; if(hashslot<0) hashslot=-hashslot; // Is it one we already know? int hashlast=m_hashStart[hashslot]; int hashcandidate=hashlast; while(hashcandidate!=NULL) { if(m_intToString.elementAt(hashcandidate).equals(s)) return hashcandidate; hashlast=hashcandidate; hashcandidate=m_hashChain.elementAt(hashcandidate); } // New value. Add to tables. int newIndex=m_intToString.size(); m_intToString.addElement(s); m_hashChain.addElement(NULL); // Initialize to no-following-same-hash if(hashlast==NULL) // First for this hash m_hashStart[hashslot]=newIndex; else // Link from previous with same hash m_hashChain.setElementAt(newIndex,hashlast); return newIndex; }
/** @return integer index uniquely identifying the value of this string. */ public int stringToIndex(String s) { if(s==null) return NULL; int hashslot=s.hashCode()%HASHPRIME; if(hashslot<0) hashslot=-hashslot; // Is it one we already know? int hashlast=m_hashStart[hashslot]; int hashcandidate=hashlast; while(hashcandidate!=NULL) { if(m_intToString.elementAt(hashcandidate).equals(s)) return hashcandidate; hashlast=hashcandidate; hashcandidate=m_hashChain.elementAt(hashcandidate); } // New value. Add to tables. int newIndex=m_intToString.size(); m_intToString.addElement(s); m_hashChain.addElement(NULL); // Initialize to no-following-same-hash if(hashlast==NULL) // First for this hash m_hashStart[hashslot]=newIndex; else // Link from previous with same hash m_hashChain.setElementAt(newIndex,hashlast); return newIndex; }
/** @return integer index uniquely identifying the value of this string. */ public int stringToIndex(String s) { if(s==null) return NULL; int hashslot=s.hashCode()%HASHPRIME; if(hashslot<0) hashslot=-hashslot; // Is it one we already know? int hashlast=m_hashStart[hashslot]; int hashcandidate=hashlast; while(hashcandidate!=NULL) { if(m_intToString.elementAt(hashcandidate).equals(s)) return hashcandidate; hashlast=hashcandidate; hashcandidate=m_hashChain.elementAt(hashcandidate); } // New value. Add to tables. int newIndex=m_intToString.size(); m_intToString.addElement(s); m_hashChain.addElement(NULL); // Initialize to no-following-same-hash if(hashlast==NULL) // First for this hash m_hashStart[hashslot]=newIndex; else // Link from previous with same hash m_hashChain.setElementAt(newIndex,hashlast); return newIndex; }
/** @return integer index uniquely identifying the value of this string. */ public int stringToIndex(String s) { if(s==null) return NULL; int hashslot=s.hashCode()%HASHPRIME; if(hashslot<0) hashslot=-hashslot; // Is it one we already know? int hashlast=m_hashStart[hashslot]; int hashcandidate=hashlast; while(hashcandidate!=NULL) { if(m_intToString.elementAt(hashcandidate).equals(s)) return hashcandidate; hashlast=hashcandidate; hashcandidate=m_hashChain.elementAt(hashcandidate); } // New value. Add to tables. int newIndex=m_intToString.size(); m_intToString.addElement(s); m_hashChain.addElement(NULL); // Initialize to no-following-same-hash if(hashlast==NULL) // First for this hash m_hashStart[hashslot]=newIndex; else // Link from previous with same hash m_hashChain.setElementAt(newIndex,hashlast); return newIndex; }
/** @return integer index uniquely identifying the value of this string. */ public int stringToIndex(String s) { if(s==null) return NULL; int hashslot=s.hashCode()%HASHPRIME; if(hashslot<0) hashslot=-hashslot; // Is it one we already know? int hashlast=m_hashStart[hashslot]; int hashcandidate=hashlast; while(hashcandidate!=NULL) { if(m_intToString.elementAt(hashcandidate).equals(s)) return hashcandidate; hashlast=hashcandidate; hashcandidate=m_hashChain.elementAt(hashcandidate); } // New value. Add to tables. int newIndex=m_intToString.size(); m_intToString.addElement(s); m_hashChain.addElement(NULL); // Initialize to no-following-same-hash if(hashlast==NULL) // First for this hash m_hashStart[hashslot]=newIndex; else // Link from previous with same hash m_hashChain.setElementAt(newIndex,hashlast); return newIndex; }
/** @return integer index uniquely identifying the value of this string. */ public int stringToIndex(String s) { if(s==null) return NULL; int hashslot=s.hashCode()%HASHPRIME; if(hashslot<0) hashslot=-hashslot; // Is it one we already know? int hashlast=m_hashStart[hashslot]; int hashcandidate=hashlast; while(hashcandidate!=NULL) { if(m_intToString.elementAt(hashcandidate).equals(s)) return hashcandidate; hashlast=hashcandidate; hashcandidate=m_hashChain.elementAt(hashcandidate); } // New value. Add to tables. int newIndex=m_intToString.size(); m_intToString.addElement(s); m_hashChain.addElement(NULL); // Initialize to no-following-same-hash if(hashlast==NULL) // First for this hash m_hashStart[hashslot]=newIndex; else // Link from previous with same hash m_hashChain.setElementAt(newIndex,hashlast); return newIndex; }
/** @return integer index uniquely identifying the value of this string. */ public int stringToIndex(String s) { if(s==null) return NULL; int hashslot=s.hashCode()%HASHPRIME; if(hashslot<0) hashslot=-hashslot; // Is it one we already know? int hashlast=m_hashStart[hashslot]; int hashcandidate=hashlast; while(hashcandidate!=NULL) { if(m_intToString.elementAt(hashcandidate).equals(s)) return hashcandidate; hashlast=hashcandidate; hashcandidate=m_hashChain.elementAt(hashcandidate); } // New value. Add to tables. int newIndex=m_intToString.size(); m_intToString.addElement(s); m_hashChain.addElement(NULL); // Initialize to no-following-same-hash if(hashlast==NULL) // First for this hash m_hashStart[hashslot]=newIndex; else // Link from previous with same hash m_hashChain.setElementAt(newIndex,hashlast); return newIndex; }
/** @return integer index uniquely identifying the value of this string. */ public int stringToIndex(String s) { if(s==null) return NULL; int hashslot=s.hashCode()%HASHPRIME; if(hashslot<0) hashslot=-hashslot; // Is it one we already know? int hashlast=m_hashStart[hashslot]; int hashcandidate=hashlast; while(hashcandidate!=NULL) { if(m_intToString.elementAt(hashcandidate).equals(s)) return hashcandidate; hashlast=hashcandidate; hashcandidate=m_hashChain.elementAt(hashcandidate); } // New value. Add to tables. int newIndex=m_intToString.size(); m_intToString.addElement(s); m_hashChain.addElement(NULL); // Initialize to no-following-same-hash if(hashlast==NULL) // First for this hash m_hashStart[hashslot]=newIndex; else // Link from previous with same hash m_hashChain.setElementAt(newIndex,hashlast); return newIndex; }
/** @return integer index uniquely identifying the value of this string. */ public int stringToIndex(String s) { if(s==null) return NULL; int hashslot=s.hashCode()%HASHPRIME; if(hashslot<0) hashslot=-hashslot; // Is it one we already know? int hashlast=m_hashStart[hashslot]; int hashcandidate=hashlast; while(hashcandidate!=NULL) { if(m_intToString.elementAt(hashcandidate).equals(s)) return hashcandidate; hashlast=hashcandidate; hashcandidate=m_hashChain.elementAt(hashcandidate); } // New value. Add to tables. int newIndex=m_intToString.size(); m_intToString.addElement(s); m_hashChain.addElement(NULL); // Initialize to no-following-same-hash if(hashlast==NULL) // First for this hash m_hashStart[hashslot]=newIndex; else // Link from previous with same hash m_hashChain.setElementAt(newIndex,hashlast); return newIndex; }
/** @return integer index uniquely identifying the value of this string. */ public int stringToIndex(String s) { if(s==null) return NULL; int hashslot=s.hashCode()%HASHPRIME; if(hashslot<0) hashslot=-hashslot; // Is it one we already know? int hashlast=m_hashStart[hashslot]; int hashcandidate=hashlast; while(hashcandidate!=NULL) { if(m_intToString.elementAt(hashcandidate).equals(s)) return hashcandidate; hashlast=hashcandidate; hashcandidate=m_hashChain.elementAt(hashcandidate); } // New value. Add to tables. int newIndex=m_intToString.size(); m_intToString.addElement(s); m_hashChain.addElement(NULL); // Initialize to no-following-same-hash if(hashlast==NULL) // First for this hash m_hashStart[hashslot]=newIndex; else // Link from previous with same hash m_hashChain.setElementAt(newIndex,hashlast); return newIndex; }