Lines 19-24
Link Here
|
19 |
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; |
19 |
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; |
20 |
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; |
20 |
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; |
21 |
import org.eclipse.jdt.internal.compiler.util.SimpleSet; |
21 |
import org.eclipse.jdt.internal.compiler.util.SimpleSet; |
|
|
22 |
import org.eclipse.jdt.internal.compiler.util.SimpleSetOfCharArray; |
22 |
|
23 |
|
23 |
public class DiskIndex { |
24 |
public class DiskIndex { |
24 |
|
25 |
|
Lines 45-50
Link Here
|
45 |
|
46 |
|
46 |
private static final int CHUNK_SIZE = 100; |
47 |
private static final int CHUNK_SIZE = 100; |
47 |
|
48 |
|
|
|
49 |
private static final SimpleSetOfCharArray INTERNED_CATEGORY_NAMES = new SimpleSetOfCharArray(20); |
50 |
|
48 |
static class IntList { |
51 |
static class IntList { |
49 |
|
52 |
|
50 |
int size; |
53 |
int size; |
Lines 487-494
Link Here
|
487 |
for (int i = 0, l = names.length; i < l; i++) |
490 |
for (int i = 0, l = names.length; i < l; i++) |
488 |
if (names[i] != null) |
491 |
if (names[i] != null) |
489 |
newDiskIndex.copyQueryResults( |
492 |
newDiskIndex.copyQueryResults( |
490 |
(HashtableOfObject) memoryIndex.docsToReferences.get(names[i]), |
493 |
(HashtableOfObject) memoryIndex.docsToReferences.get(names[i]), ((Integer) integerPositions[i]).intValue()); |
491 |
((Integer) integerPositions[i]).intValue()); |
|
|
492 |
} |
494 |
} |
493 |
indexedDocuments = null; // free up the space |
495 |
indexedDocuments = null; // free up the space |
494 |
|
496 |
|
Lines 615-621
Link Here
|
615 |
categoryTable.put(word, new Integer(arrayOffset)); // offset to array in the file |
617 |
categoryTable.put(word, new Integer(arrayOffset)); // offset to array in the file |
616 |
} |
618 |
} |
617 |
} |
619 |
} |
618 |
this.categoryTables.put(categoryName, categoryTable); |
620 |
this.categoryTables.put(INTERNED_CATEGORY_NAMES.get(categoryName), categoryTable); |
619 |
// cache the table as long as its not too big |
621 |
// cache the table as long as its not too big |
620 |
// in practice, some tables can be greater than 500K when they contain more than 10K elements |
622 |
// in practice, some tables can be greater than 500K when they contain more than 10K elements |
621 |
this.cachedCategoryName = categoryTable.elementSize < 10000 ? categoryName : null; |
623 |
this.cachedCategoryName = categoryTable.elementSize < 10000 ? categoryName : null; |
Lines 733-739
Link Here
|
733 |
int size = file.readInt(); |
735 |
int size = file.readInt(); |
734 |
this.categoryOffsets = new HashtableOfIntValues(size); |
736 |
this.categoryOffsets = new HashtableOfIntValues(size); |
735 |
for (int i = 0; i < size; i++) |
737 |
for (int i = 0; i < size; i++) |
736 |
this.categoryOffsets.put(Util.readUTF(file), file.readInt()); // cache offset to category table |
738 |
this.categoryOffsets.put(INTERNED_CATEGORY_NAMES.get(Util.readUTF(file)), file.readInt()); // cache offset to category table |
737 |
this.categoryTables = new HashtableOfObject(3); |
739 |
this.categoryTables = new HashtableOfObject(3); |
738 |
} |
740 |
} |
739 |
synchronized void startQuery() { |
741 |
synchronized void startQuery() { |