Skip to content

Commit 400dfec

Browse files
authored
Merge branch 'master' into feature/FasterXML#220-LUT-for-name-chars
2 parents b0cd38c + 012a512 commit 400dfec

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

src/main/java/com/ctc/wstx/util/SymbolTable.java

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -638,15 +638,15 @@ private void rehash()
638638
Bucket b = oldBuckets[i];
639639
while (b != null) {
640640
++count;
641-
String symbol = b.getSymbol();
641+
String symbol = b.symbol;
642642
int index = calcHash(symbol) & mIndexMask;
643643
if (mSymbols[index] == null) {
644644
mSymbols[index] = symbol;
645645
} else {
646646
int bix = index >> 1;
647647
mBuckets[bix] = new Bucket(symbol, mBuckets[bix]);
648648
}
649-
b = b.getNext();
649+
b = b.next;
650650
}
651651
}
652652

@@ -676,7 +676,7 @@ public double calcAvgSeek() {
676676
while (b != null) {
677677
count += cost;
678678
++cost;
679-
b = b.getNext();
679+
b = b.next;
680680
}
681681
}
682682

@@ -693,21 +693,18 @@ public double calcAvgSeek() {
693693
* This class is a symbol table entry. Each entry acts as a node
694694
* in a linked list.
695695
*/
696-
static final class Bucket {
697-
private final String mSymbol;
698-
private final Bucket mNext;
696+
private static final class Bucket {
697+
public final String symbol;
698+
public final Bucket next;
699699

700700
public Bucket(String symbol, Bucket next) {
701-
mSymbol = symbol;
702-
mNext = next;
701+
this.symbol = symbol;
702+
this.next = next;
703703
}
704704

705-
public String getSymbol() { return mSymbol; }
706-
public Bucket getNext() { return mNext; }
707-
708705
public String find(char[] buf, int start, int len) {
709-
String sym = mSymbol;
710-
Bucket b = mNext;
706+
String sym = symbol;
707+
Bucket b = next;
711708

712709
while (true) { // Inlined equality comparison:
713710
if (sym.length() == len) {
@@ -724,15 +721,15 @@ public String find(char[] buf, int start, int len) {
724721
if (b == null) {
725722
break;
726723
}
727-
sym = b.getSymbol();
728-
b = b.getNext();
724+
sym = b.symbol;
725+
b = b.next;
729726
}
730727
return null;
731728
}
732729

733730
public String find(String str) {
734-
String sym = mSymbol;
735-
Bucket b = mNext;
731+
String sym = symbol;
732+
Bucket b = next;
736733

737734
while (true) {
738735
if (sym.equals(str)) {
@@ -741,8 +738,8 @@ public String find(String str) {
741738
if (b == null) {
742739
break;
743740
}
744-
sym = b.getSymbol();
745-
b = b.getNext();
741+
sym = b.symbol;
742+
b = b.next;
746743
}
747744
return null;
748745
}

0 commit comments

Comments
 (0)