本文整理匯總了Java中org.eclipse.jdt.internal.compiler.util.HashtableOfObject類的典型用法代碼示例。如果您正苦於以下問題:Java HashtableOfObject類的具體用法?Java HashtableOfObject怎麽用?Java HashtableOfObject使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
HashtableOfObject類屬於org.eclipse.jdt.internal.compiler.util包,在下文中一共展示了HashtableOfObject類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initializeFrom
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; //導入依賴的package包/類
private void initializeFrom(DiskIndex diskIndex, File newIndexFile) throws IOException {
if (newIndexFile.exists() && !newIndexFile.delete()) { // delete the temporary index file
if (DEBUG)
System.out.println("initializeFrom - Failed to delete temp index " + this.indexLocation); //$NON-NLS-1$
} else if (!newIndexFile.createNewFile()) {
if (DEBUG)
System.out.println("initializeFrom - Failed to create temp index " + this.indexLocation); //$NON-NLS-1$
throw new IOException("Failed to create temp index " + this.indexLocation); //$NON-NLS-1$
}
int size = diskIndex.categoryOffsets == null ? 8 : diskIndex.categoryOffsets.elementSize;
this.categoryOffsets = new HashtableOfIntValues(size);
this.categoryEnds = new HashtableOfIntValues(size);
this.categoryTables = new HashtableOfObject(size);
this.separator = diskIndex.separator;
}
示例2: stopQuery
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; //導入依賴的package包/類
synchronized void stopQuery() {
if (--this.cacheUserCount < 0) {
// clear cached items
this.cacheUserCount = -1;
this.cachedChunks = null;
if (this.categoryTables != null) {
if (this.cachedCategoryName == null) {
this.categoryTables = null;
} else if (this.categoryTables.elementSize > 1) {
HashtableOfObject newTables = new HashtableOfObject(3);
newTables.put(this.cachedCategoryName, this.categoryTables.get(this.cachedCategoryName));
this.categoryTables = newTables;
}
}
}
}
示例3: computeMethods
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; //導入依賴的package包/類
void computeMethods() {
MethodBinding[] methods = this.type.methods();
int size = methods.length;
this.currentMethods = new HashtableOfObject(size == 0 ? 1 : size); // maps method selectors to an array of methods... must search to match paramaters & return type
for (int m = size; --m >= 0;) {
MethodBinding method = methods[m];
if (!(method.isConstructor() || method.isDefaultAbstract())) { // keep all methods which are NOT constructors or default abstract
MethodBinding[] existingMethods = (MethodBinding[]) this.currentMethods.get(method.selector);
if (existingMethods == null)
existingMethods = new MethodBinding[1];
else
System.arraycopy(existingMethods, 0,
(existingMethods = new MethodBinding[existingMethods.length + 1]), 0, existingMethods.length - 1);
existingMethods[existingMethods.length - 1] = method;
this.currentMethods.put(method.selector, existingMethods);
}
}
}
示例4: getCompilationUnits
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; //導入依賴的package包/類
@Override
public CompilationUnit[] getCompilationUnits() {
int fileCount = this.filenames.length;
CompilationUnit[] units = new CompilationUnit[fileCount];
HashtableOfObject knownFileNames = new HashtableOfObject(fileCount);
String defaultEncoding = (String)this.options.get("org.eclipse.jdt.core.encoding");
if(Util.EMPTY_STRING.equals(defaultEncoding)) {
defaultEncoding = null;
}
for(int i = 0; i < fileCount; ++i) {
char[] charName = this.filenames[i].toCharArray();
if(knownFileNames.get(charName) != null) {
throw new IllegalArgumentException(this.bind("unit.more", this.filenames[i]));
}
knownFileNames.put(charName, charName);
File file = new File(this.filenames[i]);
if(!file.exists()) {
throw new IllegalArgumentException(this.bind("unit.missing", this.filenames[i]));
}
String encoding = this.encodings[i];
if(encoding == null) {
encoding = defaultEncoding;
}
String fileName;
try {
fileName = file.getCanonicalPath();
} catch (IOException var10) {
fileName = this.filenames[i];
}
units[i] = new CompilationUnit((char[])null, fileName, encoding, this.destinationPaths[i], false, null);
}
return units;
}
示例5: CompletionEngine
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; //導入依賴的package包/類
/**
* The CompletionEngine is responsible for computing source completions.
*
* It requires a searchable name environment, which supports some
* specific search APIs, and a requestor to feed back the results to a UI.
*
* @param nameEnvironment org.eclipse.jdt.internal.codeassist.ISearchableNameEnvironment
* used to resolve type/package references and search for types/packages
* based on partial names.
*
* @param requestor org.eclipse.jdt.internal.codeassist.ICompletionRequestor
* since the engine might produce answers of various forms, the engine
* is associated with a requestor able to accept all possible completions.
*
* @param settings java.util.Map
* set of options used to configure the code assist engine.
*/
public CompletionEngine(
SearchableEnvironment nameEnvironment,
CompletionRequestor requestor,
Map settings,
IJavaProject javaProject,
WorkingCopyOwner owner,
IProgressMonitor monitor) {
super(settings);
this.javaProject = javaProject;
this.requestor = requestor;
this.nameEnvironment = nameEnvironment;
this.typeCache = new HashtableOfObject(5);
this.openedBinaryTypes = 0;
this.sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
this.complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
this.problemFactory = new CompletionProblemFactory(Locale.getDefault());
this.problemReporter = new ProblemReporter(
DefaultErrorHandlingPolicies.proceedWithAllProblems(),
this.compilerOptions,
this.problemFactory);
this.lookupEnvironment =
new LookupEnvironment(this, this.compilerOptions, this.problemReporter, nameEnvironment);
this.parser =
new CompletionParser(this.problemReporter, this.requestor.isExtendedContextRequired(), monitor);
this.owner = owner;
this.monitor = monitor;
}
示例6: reset
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; //導入依賴的package包/類
protected void reset() {
super.reset(false);
this.validPackageNames = new SimpleSetOfCharArray(10);
this.invalidPackageNames = new SimpleSetOfCharArray(1);
this.knownPkgs = new HashtableOfObject(10);
this.knownTypes = new HashtableOfObject(10);
if (this.noCacheNameEnvironment != null) {
this.noCacheNameEnvironment.cleanup();
this.noCacheNameEnvironment = null;
JavaModelManager.getJavaModelManager().flushZipFiles(this);
}
}
示例7: query
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; //導入依賴的package包/類
/**
* Returns the entries containing the given key in a group of categories, or null if no matches are found.
* The matchRule dictates whether its an exact, prefix or pattern match, as well as case sensitive or insensitive.
* If the key is null then all entries in specified categories are returned.
*/
public EntryResult[] query(char[][] categories, char[] key, int matchRule) throws IOException {
if (this.memoryIndex.shouldMerge() && this.monitor.exitReadEnterWrite()) {
try {
save();
} finally {
this.monitor.exitWriteEnterRead();
}
}
HashtableOfObject results;
int rule = matchRule & MATCH_RULE_INDEX_MASK;
if (this.memoryIndex.hasChanged()) {
results = this.diskIndex.addQueryResults(categories, key, rule, this.memoryIndex);
results = this.memoryIndex.addQueryResults(categories, key, rule, results);
} else {
results = this.diskIndex.addQueryResults(categories, key, rule, null);
}
if (results == null) return null;
EntryResult[] entryResults = new EntryResult[results.elementSize];
int count = 0;
Object[] values = results.valueTable;
for (int i = 0, l = values.length; i < l; i++) {
EntryResult result = (EntryResult) values[i];
if (result != null)
entryResults[count++] = result;
}
return entryResults;
}
示例8: copyQueryResults
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; //導入依賴的package包/類
private void copyQueryResults(HashtableOfObject categoryToWords, int newPosition) {
char[][] categoryNames = categoryToWords.keyTable;
Object[] wordSets = categoryToWords.valueTable;
for (int i = 0, l = categoryNames.length; i < l; i++) {
char[] categoryName = categoryNames[i];
if (categoryName != null) {
SimpleWordSet wordSet = (SimpleWordSet) wordSets[i];
HashtableOfObject wordsToDocs = (HashtableOfObject) this.categoryTables.get(categoryName);
if (wordsToDocs == null)
this.categoryTables.put(categoryName, wordsToDocs = new HashtableOfObject(wordSet.elementSize));
char[][] words = wordSet.words;
for (int j = 0, m = words.length; j < m; j++) {
char[] word = words[j];
if (word != null) {
Object o = wordsToDocs.get(word);
if (o == null) {
wordsToDocs.putUnsafely(word, new int[] {newPosition});
} else if (o instanceof IntList) {
((IntList) o).add(newPosition);
} else {
IntList list = new IntList((int[]) o);
list.add(newPosition);
wordsToDocs.put(word, list);
}
}
}
}
}
}
示例9: writeCategories
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; //導入依賴的package包/類
private void writeCategories(FileOutputStream stream) throws IOException {
char[][] categoryNames = this.categoryTables.keyTable;
Object[] tables = this.categoryTables.valueTable;
for (int i = 0, l = categoryNames.length; i < l; i++)
if (categoryNames[i] != null)
writeCategoryTable(categoryNames[i], (HashtableOfObject) tables[i], stream);
this.categoryTables = null;
}
示例10: BindingKeyResolver
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; //導入依賴的package包/類
private BindingKeyResolver(BindingKeyParser parser, Compiler compiler, LookupEnvironment environment, CompilationUnitDeclaration outerMostParsedUnit, HashtableOfObject parsedUnits) {
super(parser);
this.compiler = compiler;
this.environment = environment;
this.outerMostParsedUnit = outerMostParsedUnit;
this.resolvedUnits = parsedUnits;
}
示例11: getCompilationUnits
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; //導入依賴的package包/類
public CompilationUnit[] getCompilationUnits() {
int fileCount = this.filenames.length;
CompilationUnit[] units = new CompilationUnit[fileCount];
HashtableOfObject knownFileNames = new HashtableOfObject(fileCount);
String defaultEncoding = (String) this.options.get(CompilerOptions.OPTION_Encoding);
if (Util.EMPTY_STRING.equals(defaultEncoding))
defaultEncoding = null;
for (int i = 0; i < fileCount; i++) {
char[] charName = this.filenames[i].toCharArray();
if (knownFileNames.get(charName) != null)
throw new IllegalArgumentException(this.bind("unit.more", this.filenames[i])); //$NON-NLS-1$
knownFileNames.put(charName, charName);
File file = new File(this.filenames[i]);
if (!file.exists())
throw new IllegalArgumentException(this.bind("unit.missing", this.filenames[i])); //$NON-NLS-1$
String encoding = this.encodings[i];
if (encoding == null)
encoding = defaultEncoding;
String fileName;
try {
fileName = file.getCanonicalPath();
} catch (IOException e) {
// if we got exception during canonicalization, fall back to the name that was specified
fileName = this.filenames[i];
}
units[i] = new CompilationUnit(null, fileName, encoding, this.destinationPaths[i],
shouldIgnoreOptionalProblems(this.ignoreOptionalProblemsFromFolders, fileName.toCharArray()));
}
return units;
}
示例12: ConstantPool
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; //導入依賴的package包/類
/**
* ConstantPool constructor comment.
*/
public ConstantPool(ClassFile classFile) {
this.UTF8Cache = new CharArrayCache(UTF8_INITIAL_SIZE);
this.stringCache = new CharArrayCache(STRING_INITIAL_SIZE);
this.methodsAndFieldsCache = new HashtableOfObject(METHODS_AND_FIELDS_INITIAL_SIZE);
this.classCache = new CharArrayCache(CLASS_INITIAL_SIZE);
this.nameAndTypeCacheForFieldsAndMethods = new HashtableOfObject(NAMEANDTYPE_INITIAL_SIZE);
this.offsets = new int[5];
initialize(classFile);
}
示例13: CompletionEngine
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; //導入依賴的package包/類
/**
* The CompletionEngine is responsible for computing source completions.
*
* It requires a searchable name environment, which supports some
* specific search APIs, and a requestor to feed back the results to a UI.
*
* @param nameEnvironment org.eclipse.jdt.internal.codeassist.ISearchableNameEnvironment
* used to resolve type/package references and search for types/packages
* based on partial names.
*
* @param requestor org.eclipse.jdt.internal.codeassist.ICompletionRequestor
* since the engine might produce answers of various forms, the engine
* is associated with a requestor able to accept all possible completions.
*
* @param settings java.util.Map
* set of options used to configure the code assist engine.
*/
public CompletionEngine(
SearchableEnvironment nameEnvironment,
CompletionRequestor requestor,
Map settings,
IJavaProject javaProject,
WorkingCopyOwner owner,
IProgressMonitor monitor) {
super(settings);
this.javaProject = javaProject;
this.requestor = requestor;
this.nameEnvironment = nameEnvironment;
this.typeCache = new HashtableOfObject(5);
this.openedBinaryTypes = 0;
this.sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
this.complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
this.problemFactory = new CompletionProblemFactory(Locale.getDefault());
this.problemReporter = new ProblemReporter(
DefaultErrorHandlingPolicies.proceedWithAllProblems(),
this.compilerOptions,
this.problemFactory);
this.lookupEnvironment =
new LookupEnvironment(this, this.compilerOptions, this.problemReporter, nameEnvironment);
this.parser =
new CompletionParser(this.problemReporter, this.requestor.isExtendedContextRequired());
this.owner = owner;
this.monitor = monitor;
}
示例14: readHeaderInfo
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; //導入依賴的package包/類
private void readHeaderInfo(InputStream stream) throws IOException {
// must be same order as writeHeaderInfo()
this.numberOfChunks = readStreamInt(stream);
this.sizeOfLastChunk = this.streamBuffer[this.bufferIndex++] & 0xFF;
this.documentReferenceSize = this.streamBuffer[this.bufferIndex++] & 0xFF;
this.separator = (char) (this.streamBuffer[this.bufferIndex++] & 0xFF);
long length = this.indexLocation.length();
if (length != -1 && this.numberOfChunks > length) {
// not an accurate check, but good enough https://bugs.eclipse.org/bugs/show_bug.cgi?id=350612
if (DEBUG)
System.out.println("Index file is corrupted " + this.indexLocation); //$NON-NLS-1$
throw new IOException("Index file is corrupted " + this.indexLocation); //$NON-NLS-1$
}
this.chunkOffsets = new int[this.numberOfChunks];
for (int i = 0; i < this.numberOfChunks; i++)
this.chunkOffsets[i] = readStreamInt(stream);
this.startOfCategoryTables = readStreamInt(stream);
int size = readStreamInt(stream);
this.categoryOffsets = new HashtableOfIntValues(size);
this.categoryEnds = new HashtableOfIntValues(size);
if (length != -1 && size > length) {
// not an accurate check, but good enough https://bugs.eclipse.org/bugs/show_bug.cgi?id=350612
if (DEBUG)
System.out.println("Index file is corrupted " + this.indexLocation); //$NON-NLS-1$
throw new IOException("Index file is corrupted " + this.indexLocation); //$NON-NLS-1$
}
char[] previousCategory = null;
int offset = -1;
for (int i = 0; i < size; i++) {
char[] categoryName = INTERNED_CATEGORY_NAMES.get(readStreamChars(stream));
offset = readStreamInt(stream);
this.categoryOffsets.put(categoryName, offset); // cache offset to category table
if (previousCategory != null) {
this.categoryEnds.put(previousCategory, offset); // cache end of the category table
}
previousCategory = categoryName;
}
if (previousCategory != null) {
this.categoryEnds.put(previousCategory, this.headerInfoOffset); // cache end of the category table
}
this.categoryTables = new HashtableOfObject(3);
}