<s> package org . eclipse . jdt . internal . core . builder ; import org . eclipse . jdt . core . compiler . CharOperation ; public final class NameSet { public char [ ] [ ] names ; public int elementSize ; public int threshold ; public NameSet ( int size ) { this . elementSize = 0 ; this . threshold = size ; int extraRoom = ( int ) ( size * 1.5f ) ; if ( this . threshold == extraRoom ) extraRoom ++ ; this . names = new char [ extraRoom ] [ ] ; } public char [ ] add ( char [ ] name ) { int length = this . names . length ; int index = CharOperation . hashCode ( name ) % length ; char [ ] current ; while ( ( current = this . names [ index ] ) != null ) { if ( CharOperation . equals ( current , name ) ) return current ; if ( ++ index == length ) index = 0 ; } this . names [ index ] = name ; if ( ++ this . elementSize > this . threshold ) rehash ( ) ; return name ; } private void rehash ( ) { NameSet newSet = new NameSet ( this . elementSize * 2 ) ; char [ ] current ; for ( int i = this . names . length ; -- i >= 0 ; ) if ( ( current = this . names [ i ] ) != null ) newSet . add ( current ) ; this . names = newSet . names ; this . elementSize = newSet . elementSize ; this . threshold = newSet . threshold ; } public String toString ( ) { String s = "" ; char [ ] name ; for ( int i = 0 , l = this . names . length ; i < l ; i ++ ) if ( ( name = this . names [ i ] ) != null ) s += new String ( name ) + "n" ; return s ; } } </s>