equal
deleted
inserted
replaced
83 table. */ |
83 table. */ |
84 public Symbol probe(byte[] name) { |
84 public Symbol probe(byte[] name) { |
85 long hashValue = hashSymbol(name); |
85 long hashValue = hashSymbol(name); |
86 for (HashtableEntry e = (HashtableEntry) bucket(hashToIndex(hashValue)); e != null; e = (HashtableEntry) e.next()) { |
86 for (HashtableEntry e = (HashtableEntry) bucket(hashToIndex(hashValue)); e != null; e = (HashtableEntry) e.next()) { |
87 if (e.hash() == hashValue) { |
87 if (e.hash() == hashValue) { |
88 Symbol sym = (Symbol) e.literal(); |
88 Symbol sym = Symbol.create(e.literalValue()); |
89 if (sym.equals(name)) { |
89 if (sym.equals(name)) { |
90 return sym; |
90 return sym; |
91 } |
91 } |
92 } |
92 } |
93 } |
93 } |
101 public void symbolsDo(SymbolVisitor visitor) { |
101 public void symbolsDo(SymbolVisitor visitor) { |
102 int numBuckets = tableSize(); |
102 int numBuckets = tableSize(); |
103 for (int i = 0; i < numBuckets; i++) { |
103 for (int i = 0; i < numBuckets; i++) { |
104 for (HashtableEntry e = (HashtableEntry) bucket(i); e != null; |
104 for (HashtableEntry e = (HashtableEntry) bucket(i); e != null; |
105 e = (HashtableEntry) e.next()) { |
105 e = (HashtableEntry) e.next()) { |
106 visitor.visit((Symbol) e.literal()); |
106 visitor.visit(Symbol.create(e.literalValue())); |
107 } |
107 } |
108 } |
108 } |
109 } |
109 } |
110 |
110 |
111 private static byte[] toModifiedUTF8Bytes(String name) throws IOException { |
111 private static byte[] toModifiedUTF8Bytes(String name) throws IOException { |