Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.ui.dialogs
Class SearchPattern


java.lang.Object
  extended by 
org.eclipse.ui.dialogs.SearchPattern

public class SearchPattern
extends Object

A search pattern defines how search results are found.

This class is intended to be subclassed by clients. A default behavior is provided for each of the methods above, that clients can override if they wish.

Since:
3.3

Field Summary
static int RULE_BLANK_MATCH
          Match rule: The search pattern is blank.
static int RULE_CAMELCASE_MATCH
          Match rule: The search pattern contains a Camel Case expression.
static int RULE_CASE_SENSITIVE
          Match rule: The search pattern matches the search result only if cases are the same.
static int RULE_EXACT_MATCH
          Match rule: The search pattern matches exactly the search result, that is, the source of the search result equals the search pattern.
static int RULE_PATTERN_MATCH
          Match rule: The search pattern contains one or more wild cards ('*' or '?').
static int RULE_PREFIX_MATCH
          Match rule: The search pattern is a prefix of the search result.
 
Constructor Summary
SearchPattern ()
          Creates new instance of SearchPattern Default allowedRules for it is result of belong logic operation: ( RULE_EXACT_MATCH | RULE_PREFIX_MATCH | RULE_PATTERN_MATCH | RULE_CAMELCASE_MATCH )
SearchPattern (int allowedRules)
          Creates a search pattern with the rule to apply for matching index keys.
 
Method Summary
 boolean equalsPattern ( SearchPattern pattern)
          Tells whether the given SearchPattern equals this pattern.
 int getMatchRule ()
          Returns the rule to apply for matching keys.
  String getPattern ()
          Gets string pattern used by matcher
protected  boolean isNameCharAllowed (char nameChar)
          Checks character of element's name is allowed for specified set.
protected  boolean isPatternCharAllowed (char patternChar)
          Checks pattern's character is allowed for specified set.
 boolean isSubPattern ( SearchPattern pattern)
          Tells whether the given SearchPattern is a sub-pattern of this pattern.
protected  boolean isValidCamelCaseChar (char ch)
          Check if character is valid camelCase character
 boolean matches ( String text)
          Matches text with pattern. matching is determine by matchKind.
 void setPattern ( String stringPattern)
           
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RULE_EXACT_MATCH

public static final int RULE_EXACT_MATCH
Match rule: The search pattern matches exactly the search result, that is, the source of the search result equals the search pattern. Search pattern should start from lowerCase char.

See Also:
Constant Field Values

RULE_PREFIX_MATCH

public static final int RULE_PREFIX_MATCH
Match rule: The search pattern is a prefix of the search result.

See Also:
Constant Field Values

RULE_PATTERN_MATCH

public static final int RULE_PATTERN_MATCH
Match rule: The search pattern contains one or more wild cards ('*' or '?'). A '*' wild-card can replace 0 or more characters in the search result. A '?' wild-card replaces exactly 1 character in the search result.

See Also:
Constant Field Values

RULE_CASE_SENSITIVE

public static final int RULE_CASE_SENSITIVE
Match rule: The search pattern matches the search result only if cases are the same. Can be combined to previous rules, e.g. RULE_EXACT_MATCH | RULE_CASE_SENSITIVE

See Also:
Constant Field Values

RULE_BLANK_MATCH

public static final int RULE_BLANK_MATCH
Match rule: The search pattern is blank.

See Also:
Constant Field Values

RULE_CAMELCASE_MATCH

public static final int RULE_CAMELCASE_MATCH
Match rule: The search pattern contains a Camel Case expression.
Examples:
  • NPE type string pattern will match NullPointerException and NpPermissionException types,
  • NuPoEx type string pattern will only match NullPointerException type.

Can be combined to RULE_PREFIX_MATCH match rule. For example, when prefix match rule is combined with Camel Case match rule, "nPE" pattern will match nPException.
Match rule RULE_PATTERN_MATCH may also be combined but both rules will not be used simultaneously as they are mutually exclusive. Used match rule depends on whether string pattern contains specific pattern characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule will be used, otherwise only Camel Case match will be used. For example, with "NPE" string pattern, search will only use Camel Case match rule, but with N*P*E* string pattern, it will use only Pattern match rule.

See Also:
Constant Field Values
Constructor Detail

SearchPattern

public SearchPattern()
Creates new instance of SearchPattern Default allowedRules for it is result of belong logic operation: ( RULE_EXACT_MATCH | RULE_PREFIX_MATCH | RULE_PATTERN_MATCH | RULE_CAMELCASE_MATCH )


SearchPattern

public SearchPattern(int allowedRules)
Creates a search pattern with the rule to apply for matching index keys. It can be exact match, prefix match, pattern match or camelCase match. Rule can also be combined with a case sensitivity flag.

Parameters:
allowedRules - one of RULE_EXACT_MATCH, RULE_PREFIX_MATCH, RULE_PATTERN_MATCH, RULE_CASE_SENSITIVE, RULE_CAMELCASE_MATCH combined with one of following values: RULE_EXACT_MATCH, RULE_PREFIX_MATCH, RULE_PATTERN_MATCH or RULE_CAMELCASE_MATCH. e.g. RULE_EXACT_MATCH | RULE_CASE_SENSITIVE if an exact and case sensitive match is requested, RULE_PREFIX_MATCH if a prefix non case sensitive match is requested or RULE_EXACT_MATCH if a non case sensitive and erasure match is requested.
Note also that default behavior for generic types/methods search is to find exact matches.
Method Detail

getPattern

public 
String getPattern()
Gets string pattern used by matcher

Returns:
pattern

setPattern

public void setPattern(
String stringPattern)
Parameters:
stringPattern - The stringPattern to set.

matches

public boolean matches(
String text)
Matches text with pattern. matching is determine by matchKind.

Parameters:
text -
Returns:
true if search pattern was matched with text false in other way

isPatternCharAllowed

protected boolean isPatternCharAllowed(char patternChar)
Checks pattern's character is allowed for specified set. It could be override if you want change logic of camelCaseMatch methods.

Parameters:
patternChar -
Returns:
true if patternChar is in set of allowed characters for pattern

isNameCharAllowed

protected boolean isNameCharAllowed(char nameChar)
Checks character of element's name is allowed for specified set. It could be override if you want change logic of camelCaseMatch methods.

Parameters:
nameChar - - name of searched element
Returns:
if nameChar is in set of allowed characters for name of element

getMatchRule

public final int getMatchRule()
Returns the rule to apply for matching keys. Can be exact match, prefix match, pattern match or camelcase match. Rule can also be combined with a case sensitivity flag.

Returns:
one of RULE_EXACT_MATCH, RULE_PREFIX_MATCH, RULE_PATTERN_MATCH, RULE_CAMELCASE_MATCH, combined with RULE_CASE_SENSITIVE, e.g. RULE_EXACT_MATCH | RULE_CASE_SENSITIVE if an exact and case sensitive match is requested, or RULE_PREFIX_MATCH if a prefix non case sensitive match is requested.

isValidCamelCaseChar

protected boolean isValidCamelCaseChar(char ch)
Check if character is valid camelCase character

Parameters:
ch - character to be validated
Returns:
true if character is valid

equalsPattern

public boolean equalsPattern(
SearchPattern pattern)
Tells whether the given SearchPattern equals this pattern.

Parameters:
pattern - pattern to be checked
Returns:
true if the given pattern equals this search pattern

isSubPattern

public boolean isSubPattern(
SearchPattern pattern)
Tells whether the given SearchPattern is a sub-pattern of this pattern.

WARNING: This method is not defined in reading order, i.e. a.isSubPattern(b) is true iff b is a sub-pattern of a, and not vice-versa.

Parameters:
pattern - pattern to be checked
Returns:
true if the given pattern is a sub pattern of this search pattern

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire