java.lang.Object
org.eclipse.ui.internal.ide.StringMatcher
- public class StringMatcher
- extends java.lang.Object
A string pattern matcher suppporting '*' and '?' wildcards.
|
Constructor Summary |
StringMatcher(java.lang.String pattern,
boolean ignoreCase,
boolean ignoreWildCards)
StringMatcher constructor takes in a String object that is a simple
pattern which may contain '*' for 0 and many characters and
'?' for exactly one character. |
|
Method Summary |
StringMatcher.Position |
find(java.lang.String text,
int start,
int end)
Find the first occurrence of the pattern between startend(exclusive). |
boolean |
match(java.lang.String text)
match the given text with the pattern |
boolean |
match(java.lang.String text,
int start,
int end)
Given the starting (inclusive) and the ending (exclusive) positions in the
text, determine if the given substring matches with aPattern |
private void |
parseNoWildCards()
This method parses the given pattern into segments seperated by wildcard '*' characters. |
private void |
parseWildCards()
Parses the given pattern into segments seperated by wildcard '*' characters. |
protected int |
posIn(java.lang.String text,
int start,
int end)
|
protected int |
regExpPosIn(java.lang.String text,
int start,
int end,
java.lang.String p)
|
protected boolean |
regExpRegionMatches(java.lang.String text,
int tStart,
java.lang.String p,
int pStart,
int plen)
|
protected int |
textPosIn(java.lang.String text,
int start,
int end,
java.lang.String p)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fPattern
protected java.lang.String fPattern
fLength
protected int fLength
fIgnoreWildCards
protected boolean fIgnoreWildCards
fIgnoreCase
protected boolean fIgnoreCase
fHasLeadingStar
protected boolean fHasLeadingStar
fHasTrailingStar
protected boolean fHasTrailingStar
fSegments
protected java.lang.String[] fSegments
fBound
protected int fBound
fSingleWildCard
protected static final char fSingleWildCard
- See Also:
- Constant Field Values
StringMatcher
public StringMatcher(java.lang.String pattern,
boolean ignoreCase,
boolean ignoreWildCards)
- StringMatcher constructor takes in a String object that is a simple
pattern which may contain '*' for 0 and many characters and
'?' for exactly one character.
Literal '*' and '*' characters must be escaped in the pattern
e.g. "\*" means literal "*", etc.
Escaping any other character (including the escape character itself),
just results in that character in the pattern.
e.g. "\a" means "a" and "\\" means "\"
If invoking the StringMatcher with string literals in Java, don't forget
escape characters are represented by "\\".
find
public StringMatcher.Position find(java.lang.String text,
int start,
int end)
- Find the first occurrence of the pattern between
startend(exclusive).
match
public boolean match(java.lang.String text)
- match the given
text with the pattern
match
public boolean match(java.lang.String text,
int start,
int end)
- Given the starting (inclusive) and the ending (exclusive) positions in the
text, determine if the given substring matches with aPattern
parseNoWildCards
private void parseNoWildCards()
- This method parses the given pattern into segments seperated by wildcard '*' characters.
Since wildcards are not being used in this case, the pattern consists of a single segment.
parseWildCards
private void parseWildCards()
- Parses the given pattern into segments seperated by wildcard '*' characters.
posIn
protected int posIn(java.lang.String text,
int start,
int end)
regExpPosIn
protected int regExpPosIn(java.lang.String text,
int start,
int end,
java.lang.String p)
regExpRegionMatches
protected boolean regExpRegionMatches(java.lang.String text,
int tStart,
java.lang.String p,
int pStart,
int plen)
textPosIn
protected int textPosIn(java.lang.String text,
int start,
int end,
java.lang.String p)