Package megamek.client.ui.panels
Class OptionSearchFilter
java.lang.Object
megamek.client.ui.panels.OptionSearchFilter
The text matching behind the search boxes on the option lists (special pilot abilities, quirks).
Matching is a case-insensitive substring test. Callers normalize a row's searchable text once, when the row is
built, and normalize the filter text once per filter pass, so a keystroke costs one String.contains(java.lang.CharSequence) per
row rather than a fresh lower-casing of everything.
-
Method Summary
-
Method Details
-
normalize
- Parameters:
text- any display text- Returns:
- the text folded to a form suitable for matching. Always apply this to both sides before calling
matches(String, String).
-
matches
- Parameters:
normalizedSearchText- a row's searchable text, alreadynormalizednormalizedFilter- the filter text, already normalized- Returns:
trueif the row should stay visible: an empty filter matches everything, otherwise the search text must contain the filter
-