Adds a compression entry mapping a name to a position in a message. @param pos The position at which the name is added. @param name The name being added to the message.
(int pos, Name name)
| 37 | * @param name The name being added to the message. |
| 38 | */ |
| 39 | public void |
| 40 | add(int pos, Name name) { |
| 41 | if (pos > MAX_POINTER) |
| 42 | return; |
| 43 | int row = (name.hashCode() & 0x7FFFFFFF) % TABLE_SIZE; |
| 44 | Entry entry = new Entry(); |
| 45 | entry.name = name; |
| 46 | entry.pos = pos; |
| 47 | entry.next = table[row]; |
| 48 | table[row] = entry; |
| 49 | if (verbose) |
| 50 | System.err.println("Adding " + name + " at " + pos); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Retrieves the position of the given name, if it has been previously |