Package org.eclipse.cdt.core.parser.util
Class SegmentMatcher
- java.lang.Object
-
- org.eclipse.cdt.core.parser.util.SegmentMatcher
-
public class SegmentMatcher extends java.lang.ObjectA matcher for camel case matching supporting both the camel case as well as he underscore notation.- Since:
- 5.3
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Constructor Summary
Constructors Constructor Description SegmentMatcher(char[] pattern)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description char[]getPrefixForBinarySearch()The pattern used by this matcher is not suitable for binary searches (e.g.booleanmatch(char[] name)Matches the given name by prefix and segment matching.static booleanmatch(char[] pattern, char[] name)Matches pattern to name by prefix and segment matching.booleanmatchPrefix(char[] name)Matches the given name by prefix matching.booleanmatchRequiredAfterBinarySearch()booleanmatchSegments(char[] name)Matches the given name by segment matching.
-
-
-
Method Detail
-
match
public boolean match(char[] name)
Matches the given name by prefix and segment matching.- Returns:
- true if the associated pattern is a prefix-based or segment-based abbreviation of name.
-
matchPrefix
public boolean matchPrefix(char[] name)
Matches the given name by prefix matching.- Returns:
- true if the associated pattern is a prefix-based abbreviation of name.
-
matchSegments
public boolean matchSegments(char[] name)
Matches the given name by segment matching.- Returns:
- true if the associated pattern is a segment-based abbreviation of name.
-
match
public static boolean match(char[] pattern, char[] name)Matches pattern to name by prefix and segment matching. If you have to match against the same pattern repeatedly, create aSegmentMatcherinstead and re-use it all the time, because this is much faster.- Returns:
- true if pattern is a prefix-based or segment-based abbreviation of name
-
getPrefixForBinarySearch
public char[] getPrefixForBinarySearch()
The pattern used by this matcher is not suitable for binary searches (e.g. within the index). However, there can be calculated a string that can be used in the context of binary searches. In the compare method used by your binary search, return 0 for any string that starts with the returned string.- Returns:
- Such a string.
-
matchRequiredAfterBinarySearch
public boolean matchRequiredAfterBinarySearch()
- Returns:
- If false, calling
match(char[])can be skipped if a name survived a binary search using the prefix returned bygetPrefixForBinarySearch()as key.
-
-