Example usage for org.eclipse.jdt.core.compiler CharOperation concat

List of usage examples for org.eclipse.jdt.core.compiler CharOperation concat

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.compiler CharOperation concat.

Prototype

public static final char[] concat(char[] first, char sep1, char[] second, char sep2, char[] third) 

Source Link

Document

Answers the concatenation of the three arrays inserting the sep1 character between the first two arrays and sep2 between the last two.

Usage

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;//from w  w w .  jav  a 2  s  .  c om
    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
}