当前位置: 首页>>代码示例>>Java>>正文


Java SearchPattern.R_PATTERN_MATCH属性代码示例

本文整理汇总了Java中org.eclipse.jdt.core.search.SearchPattern.R_PATTERN_MATCH属性的典型用法代码示例。如果您正苦于以下问题:Java SearchPattern.R_PATTERN_MATCH属性的具体用法?Java SearchPattern.R_PATTERN_MATCH怎么用?Java SearchPattern.R_PATTERN_MATCH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.jdt.core.search.SearchPattern的用法示例。


在下文中一共展示了SearchPattern.R_PATTERN_MATCH属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: matches

public boolean matches(String text) {
	switch (fMatchKind) {
		case SearchPattern.R_PATTERN_MATCH:
			return fStringMatcher.match(text);
		case SearchPattern.R_EXACT_MATCH:
			return fPattern.equalsIgnoreCase(text);
		case SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH:
			return SearchPattern.camelCaseMatch(fPattern, text, true);
		case SearchPattern.R_CAMELCASE_MATCH:
			if (SearchPattern.camelCaseMatch(fPattern, text)) {
				return true;
			}
			// fall back to prefix match if camel case failed (bug 137244)
			return Strings.startsWithIgnoreCase(text, fPattern);
		default:
			return Strings.startsWithIgnoreCase(text, fPattern);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:PatternMatcher.java

示例2: getMatchMode

private int getMatchMode(String pattern) {
  if (pattern.indexOf('*') != -1 || pattern.indexOf('?') != -1) {
    return SearchPattern.R_PATTERN_MATCH;
  } else if (SearchUtils.isCamelCasePattern(pattern)) {
    return SearchPattern.R_CAMELCASE_MATCH;
  }
  return SearchPattern.R_EXACT_MATCH;
}
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:JavaSearchQuery.java

示例3: getMatchMode

private int getMatchMode(String pattern) {
	if (pattern.indexOf('*') != -1 || pattern.indexOf('?') != -1) {
		return SearchPattern.R_PATTERN_MATCH;
	} else if (SearchUtils.isCamelCasePattern(pattern)) {
		return SearchPattern.R_CAMELCASE_MATCH;
	}
	return SearchPattern.R_EXACT_MATCH;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:JavaSearchQuery.java

示例4: PatternMatcher

private PatternMatcher(String pattern, int allowedModes) {
	initializePatternAndMatchKind(pattern);
	fMatchKind= fMatchKind & allowedModes;
	if (fMatchKind == SearchPattern.R_PATTERN_MATCH) {
		fStringMatcher= new StringMatcher(fPattern, true, false);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:PatternMatcher.java

示例5: initializePatternAndMatchKind

private void initializePatternAndMatchKind(String pattern) {
	int length= pattern.length();
	if (length == 0) {
		fMatchKind= SearchPattern.R_EXACT_MATCH;
		fPattern= pattern;
		return;
	}
	char last= pattern.charAt(length - 1);

	if (pattern.indexOf('*') != -1 || pattern.indexOf('?') != -1) {
		fMatchKind= SearchPattern.R_PATTERN_MATCH;
		switch (last) {
			case END_SYMBOL:
			case BLANK:
				fPattern= pattern.substring(0, length - 1);
				break;
			case ANY_STRING:
				fPattern= pattern;
				break;
			default:
				fPattern= pattern + ANY_STRING;
		}
		return;
	}

	if (last == END_SYMBOL || last == BLANK) {
		fPattern= pattern.substring(0, length - 1);
		if (SearchPattern.validateMatchRule(fPattern,SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH)
				== SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH) {
			fMatchKind= SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
		} else {
			fMatchKind= SearchPattern.R_EXACT_MATCH;
		}
		return;
	}

	if (SearchUtils.isCamelCasePattern(pattern)) {
		fMatchKind= SearchPattern.R_CAMELCASE_MATCH;
		fPattern= pattern;
		return;
	}

	fMatchKind= SearchPattern.R_PREFIX_MATCH;
	fPattern= pattern;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:45,代码来源:PatternMatcher.java

示例6: matchLevelForTokens

protected int matchLevelForTokens(char[][] tokens) {
	if (this.pattern.pkgName == null) return ACCURATE_MATCH;

	switch (this.matchMode) {
		case SearchPattern.R_EXACT_MATCH:
		case SearchPattern.R_PREFIX_MATCH:
			if (CharOperation.prefixEquals(this.pattern.pkgName, CharOperation.concatWith(tokens, '.'), this.isCaseSensitive)) {
				return POSSIBLE_MATCH;
			}
			break;

		case SearchPattern.R_PATTERN_MATCH:
			char[] patternName = this.pattern.pkgName[this.pattern.pkgName.length - 1] == '*'
				? this.pattern.pkgName
				: CharOperation.concat(this.pattern.pkgName, ".*".toCharArray()); //$NON-NLS-1$
			if (CharOperation.match(patternName, CharOperation.concatWith(tokens, '.'), this.isCaseSensitive)) {
				return POSSIBLE_MATCH;
			}
			break;

		case SearchPattern.R_REGEXP_MATCH :
			// TODO (frederic) implement regular expression match
			break;

		case SearchPattern.R_CAMELCASE_MATCH:
			char[] packageName = CharOperation.concatWith(tokens, '.');
			if (CharOperation.camelCaseMatch(this.pattern.pkgName, packageName, false)) {
				return POSSIBLE_MATCH;
			}
			// only test case insensitive as CamelCase already verified prefix case sensitive
			if (!this.isCaseSensitive && CharOperation.prefixEquals(this.pattern.pkgName, packageName, false)) {
				return POSSIBLE_MATCH;
			}
			break;

		case SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH:
			if (CharOperation.camelCaseMatch(this.pattern.pkgName, CharOperation.concatWith(tokens, '.'), true)) {
				return POSSIBLE_MATCH;
			}
			break;
	}
	return IMPOSSIBLE_MATCH;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:43,代码来源:PackageReferenceLocator.java


注:本文中的org.eclipse.jdt.core.search.SearchPattern.R_PATTERN_MATCH属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。