Puts the given item in the constant pool's hash table. The hash table must not already contains this item. @param i the item to be added to the constant pool's hash table.
(final Item i)
| 924 | */ |
| 925 | |
| 926 | private void put (final Item i) { |
| 927 | if (index > threshold) { |
| 928 | int oldCapacity = table.length; |
| 929 | Item oldMap[] = table; |
| 930 | int newCapacity = oldCapacity * 2 + 1; |
| 931 | Item newMap[] = new Item[newCapacity]; |
| 932 | threshold = (int)(newCapacity * 0.75); |
| 933 | table = newMap; |
| 934 | for (int j = oldCapacity; j-- > 0; ) { |
| 935 | for (Item old = oldMap[j]; old != null; ) { |
| 936 | Item e = old; |
| 937 | old = old.next; |
| 938 | int index = (e.hashCode & 0x7FFFFFFF) % newCapacity; |
| 939 | e.next = newMap[index]; |
| 940 | newMap[index] = e; |
| 941 | } |
| 942 | } |
| 943 | } |
| 944 | int index = (i.hashCode & 0x7FFFFFFF) % table.length; |
| 945 | i.next = table[index]; |
| 946 | table[index] = i; |
| 947 | } |
| 948 | |
| 949 | /** |
| 950 | * Puts one byte and two shorts into the constant pool. |
no outgoing calls
no test coverage detected