List of usage examples for org.eclipse.jdt.internal.core.index Index query
public EntryResult[] query(char[][] categories, char[] key, int matchRule) throws IOException
From source file:com.codenvy.ide.ext.java.server.core.search.SearchPattern.java
License:Open Source License
/** * @noreference This method is not intended to be referenced by clients. * @nooverride This method is not intended to be re-implemented or extended by clients. *///from w w w. j a v a 2 s .co m public EntryResult[] queryIn(Index index) throws IOException { return index.query(getIndexCategories(), getIndexKey(), getMatchRule()); }
From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.ConstructorPattern.java
License:Open Source License
public EntryResult[] queryIn(Index index) throws IOException { char[] key = this.declaringSimpleName; // can be null int matchRule = getMatchRule(); switch (getMatchMode()) { case R_EXACT_MATCH: if (this.declaringSimpleName != null && this.parameterCount >= 0 && !this.varargs) { key = createIndexKey(this.declaringSimpleName, this.parameterCount); }//from w w w . ja v a 2s.c o m matchRule &= ~R_EXACT_MATCH; matchRule |= R_PREFIX_MATCH; break; case R_PREFIX_MATCH: // do a prefix query with the declaringSimpleName break; case R_PATTERN_MATCH: if (this.parameterCount >= 0 && !this.varargs) { key = CharOperation.concat( createIndexKey(this.declaringSimpleName == null ? ONE_STAR : this.declaringSimpleName, this.parameterCount), ONE_STAR); } else if (this.declaringSimpleName != null && this.declaringSimpleName[this.declaringSimpleName.length - 1] != '*') { key = CharOperation.concat(this.declaringSimpleName, ONE_STAR, SEPARATOR); } else if (key != null) { key = CharOperation.concat(key, ONE_STAR); } // else do a pattern query with just the declaringSimpleName break; case R_REGEXP_MATCH: // TODO (frederic) implement regular expression match break; case R_CAMELCASE_MATCH: case R_CAMELCASE_SAME_PART_COUNT_MATCH: // do a prefix query with the declaringSimpleName break; } return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null }
From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.MethodPattern.java
License:Open Source License
public EntryResult[] queryIn(Index index) throws IOException { char[] key = this.selector; // can be null int matchRule = getMatchRule(); switch (getMatchMode()) { case R_EXACT_MATCH: if (this.selector != null && this.parameterCount >= 0 && !this.varargs) key = createIndexKey(this.selector, this.parameterCount); else { // do a prefix query with the selector matchRule &= ~R_EXACT_MATCH; matchRule |= R_PREFIX_MATCH; }/*from ww w . j a v a2 s .c o m*/ break; case R_PREFIX_MATCH: // do a prefix query with the selector break; case R_PATTERN_MATCH: if (this.parameterCount >= 0 && !this.varargs) key = createIndexKey(this.selector == null ? ONE_STAR : this.selector, this.parameterCount); else if (this.selector != null && this.selector[this.selector.length - 1] != '*') key = CharOperation.concat(this.selector, ONE_STAR, SEPARATOR); // else do a pattern query with just the selector break; case R_REGEXP_MATCH: // TODO (frederic) implement regular expression match break; case R_CAMELCASE_MATCH: case R_CAMELCASE_SAME_PART_COUNT_MATCH: // do a prefix query with the selector break; } return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null }
From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.MultiTypeDeclarationPattern.java
License:Open Source License
public EntryResult[] queryIn(Index index) throws IOException { if (this.simpleNames == null) { // if no simple names then return all possible ones from index return index.query(getIndexCategories(), null, -1); // match rule is irrelevant when the key is null }//from www. j a va2s . c o m int count = -1; int numOfNames = this.simpleNames.length; EntryResult[][] allResults = numOfNames > 1 ? new EntryResult[numOfNames][] : null; for (int i = 0; i < numOfNames; i++) { char[] key = this.simpleNames[i]; int matchRule = getMatchRule(); switch (getMatchMode()) { case R_PREFIX_MATCH: // do a prefix query with the simpleName break; case R_EXACT_MATCH: // do a prefix query with the simpleName matchRule &= ~R_EXACT_MATCH; matchRule |= R_PREFIX_MATCH; key = CharOperation.append(key, SEPARATOR); break; case R_PATTERN_MATCH: if (key[key.length - 1] != '*') key = CharOperation.concat(key, ONE_STAR, SEPARATOR); break; case R_REGEXP_MATCH: // TODO (frederic) implement regular expression match break; case R_CAMELCASE_MATCH: case R_CAMELCASE_SAME_PART_COUNT_MATCH: // do a prefix query with the simpleName break; } EntryResult[] entries = index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null if (entries != null) { if (allResults == null) return entries; allResults[++count] = entries; } } if (count == -1) return null; int total = 0; for (int i = 0; i <= count; i++) total += allResults[i].length; EntryResult[] allEntries = new EntryResult[total]; int next = 0; for (int i = 0; i <= count; i++) { EntryResult[] entries = allResults[i]; System.arraycopy(entries, 0, allEntries, next, entries.length); next += entries.length; } return allEntries; }
From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.SecondaryTypeDeclarationPattern.java
License:Open Source License
public EntryResult[] queryIn(Index index) throws IOException { return index.query(CATEGORIES, SECONDARY_PATTERN_KEY, R_PATTERN_MATCH | R_CASE_SENSITIVE); }
From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.SuperTypeReferencePattern.java
License:Open Source License
public EntryResult[] queryIn(Index index) throws IOException { char[] key = this.superSimpleName; // can be null int matchRule = getMatchRule(); // cannot include the superQualification since it may not exist in the index switch (getMatchMode()) { case R_EXACT_MATCH: // do a prefix query with the superSimpleName matchRule &= ~R_EXACT_MATCH; matchRule |= R_PREFIX_MATCH;//from w w w. j a va 2 s. c o m if (this.superSimpleName != null) key = CharOperation.append(this.superSimpleName, SEPARATOR); break; case R_PREFIX_MATCH: // do a prefix query with the superSimpleName break; case R_PATTERN_MATCH: // do a pattern query with the superSimpleName break; case R_REGEXP_MATCH: // TODO (frederic) implement regular expression match break; case R_CAMELCASE_MATCH: case R_CAMELCASE_SAME_PART_COUNT_MATCH: // do a prefix query with the superSimpleName break; } return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null }
From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.TypeDeclarationPattern.java
License:Open Source License
public EntryResult[] queryIn(Index index) throws IOException { char[] key = this.simpleName; // can be null int matchRule = getMatchRule(); switch (getMatchMode()) { case R_PREFIX_MATCH: // do a prefix query with the simpleName break;// w w w. jav a2s . c o m case R_EXACT_MATCH: matchRule &= ~R_EXACT_MATCH; if (this.simpleName != null) { matchRule |= R_PREFIX_MATCH; key = this.pkg == null ? CharOperation.append(this.simpleName, SEPARATOR) : CharOperation.concat(this.simpleName, SEPARATOR, this.pkg, SEPARATOR, CharOperation.NO_CHAR); break; // do a prefix query with the simpleName and possibly the pkg } matchRule |= R_PATTERN_MATCH; // $FALL-THROUGH$ - fall thru to encode the key and do a pattern query case R_PATTERN_MATCH: if (this.pkg == null) { if (this.simpleName == null) { switch (this.typeSuffix) { case CLASS_SUFFIX: case INTERFACE_SUFFIX: case ENUM_SUFFIX: case ANNOTATION_TYPE_SUFFIX: case CLASS_AND_INTERFACE_SUFFIX: case CLASS_AND_ENUM_SUFFIX: case INTERFACE_AND_ANNOTATION_SUFFIX: // null key already returns all types // key = new char[] {ONE_STAR[0], SEPARATOR, ONE_STAR[0]}; break; } } else if (this.simpleName[this.simpleName.length - 1] != '*') { key = CharOperation.concat(this.simpleName, ONE_STAR, SEPARATOR); } break; // do a pattern query with the current encoded key } // must decode to check enclosingTypeNames due to the encoding of local types key = CharOperation.concat(this.simpleName == null ? ONE_STAR : this.simpleName, SEPARATOR, this.pkg, SEPARATOR, ONE_STAR); break; case R_REGEXP_MATCH: // TODO (frederic) implement regular expression match break; case R_CAMELCASE_MATCH: case R_CAMELCASE_SAME_PART_COUNT_MATCH: // do a prefix query with the simpleName break; } return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null }