Class StringMatchUtil
- java.lang.Object
-
- net.sourceforge.pmd.util.fxdesigner.util.autocomplete.matchers.StringMatchUtil
-
public final class StringMatchUtil extends Object
Utility class.
-
-
Field Summary
Fields Modifier and Type Field Description static int
MIN_QUERY_LENGTH
static int
PERFECT_SCORE
static int
WORST_SCORE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Stream<MatchResult<T>>
filterResults(List<? extends T> candidates, Function<? super T,String> matchExtractor, String query, MatchSelector<T> limiter)
Selects the bestMatchResult
given a list of candidates and a query.
-
-
-
Field Detail
-
MIN_QUERY_LENGTH
public static final int MIN_QUERY_LENGTH
- See Also:
- Constant Field Values
-
WORST_SCORE
public static final int WORST_SCORE
- See Also:
- Constant Field Values
-
PERFECT_SCORE
public static final int PERFECT_SCORE
- See Also:
- Constant Field Values
-
-
Method Detail
-
filterResults
public static <T> Stream<MatchResult<T>> filterResults(List<? extends T> candidates, Function<? super T,String> matchExtractor, String query, MatchSelector<T> limiter)
Selects the bestMatchResult
given a list of candidates and a query.The results are useless unless you provide the
MatchSelector
that suits your use case (limiter).- Parameters:
candidates
- List of stuff to sortmatchExtractor
- Extracts the searchable text from an itemlimiter
- Selects the best candidates, may process them further to break tiesquery
- Text to search for
-
-