org.cojen.util
Class PatternMatcher
java.lang.Object
org.cojen.util.PatternMatcher
public abstract class PatternMatcher
- extends Object
Provides fast matching of strings against patterns containing wildcards.
An ordinary map must be supplied in order to create a PatternMatcher. The
map keys must be strings. Asterisks (*) are treated as wildcard characters.
- Author:
- Brian S O'Neill
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mValues
protected final Object[] mValues
PatternMatcher
protected PatternMatcher(Object[] values)
forPatterns
public static PatternMatcher forPatterns(Map patternMap)
getMatch
public PatternMatcher.Result getMatch(String lookup)
- Returns null if no match.
getMatches
public PatternMatcher.Result[] getMatches(String lookup,
int limit)
- Returns an empty array if no matches.
- Parameters:
limit
- maximum number of results to return
fillMatchResults
protected abstract void fillMatchResults(char[] lookup,
int limit,
List results)
addMatchResult
protected static boolean addMatchResult(int limit,
List results,
String pattern,
Object value,
int[] positions,
int len)
Copyright © 2004-2011 Brian S O'Neill. All Rights Reserved.