Class FilteringOutlinePopup.StringMatcher
- java.lang.Object
-
- org.eclipse.handly.ui.quickoutline.FilteringOutlinePopup.StringMatcher
-
- All Implemented Interfaces:
java.util.function.Predicate<java.lang.String>
- Enclosing class:
- FilteringOutlinePopup
protected static class FilteringOutlinePopup.StringMatcher extends java.lang.Object implements java.util.function.Predicate<java.lang.String>
A string pattern matcher that supports '*' and '?' wildcards.
-
-
Constructor Summary
Constructors Constructor Description StringMatcher(java.lang.String pattern, boolean ignoreCase)
Creates a new string matcher based on the given pattern.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
test(java.lang.String text)
protected java.lang.String
translatePattern(java.lang.String pattern)
Translates the given pattern into a regular expression.
-
-
-
Constructor Detail
-
StringMatcher
public StringMatcher(java.lang.String pattern, boolean ignoreCase)
Creates a new string matcher based on the given pattern. The pattern may contain '*' for zero or more characters and '?' for exactly one character.- Parameters:
pattern
- the pattern string (notnull
)ignoreCase
- whether case-insensitive matching is enabled
-
-
Method Detail
-
test
public final boolean test(java.lang.String text)
- Specified by:
test
in interfacejava.util.function.Predicate<java.lang.String>
-
translatePattern
protected java.lang.String translatePattern(java.lang.String pattern)
Translates the given pattern into a regular expression.This implementation always returns a regular expression that starts with '^'.
- Parameters:
pattern
- the pattern string (notnull
)- Returns:
- the regular expression corresponding to the pattern
(never
null
)
-
-