public final class TextMatchers
extends java.lang.Object
| Constructor and Description |
|---|
TextMatchers() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isMatcherConstrained(TextMatcher oldMatcher,
TextMatcher newMatcher)
A method to determine if
newMatcher is an absolute
constrainment of oldMatcher, meaning it is guaranteed to
match fewer items than the oldMatcher. |
static boolean |
isMatcherRelaxed(TextMatcher oldMatcher,
TextMatcher newMatcher)
A method to determine if
newMatcher is an absolute
relaxation of oldMatcher, meaning it is guaranteed to
match more items than the oldMatcher. |
static <E> boolean |
matches(java.util.List<java.lang.String> filterStrings,
TextFilterator<? super E> filterator,
SearchTerm<E>[] searchTerms,
TextSearchStrategy[] filterStrategies,
E element)
Execute the logic that determines whether the given
element
is matched by all of the given filterStrategies. |
static SearchTerm[] |
normalizeSearchTerms(SearchTerm[] filters,
TextSearchStrategy.Factory strategy)
This convenience function maps each of the
filters by
running each of their characters through the characterMap. |
static <E> SearchTerm<E>[] |
parse(java.lang.String text)
Parse the given
text and produce an array of
SearchTerm objects that describe text to match as well as
metadata about the way it should be used. |
static <E> SearchTerm<E>[] |
parse(java.lang.String text,
java.util.Set<SearchEngineTextMatcherEditor.Field<E>> fields)
Parse the given
text and produce an array of
SearchTerm objects that describe text to match as well as
metadata about the way it should be used. |
public static <E> boolean matches(java.util.List<java.lang.String> filterStrings,
TextFilterator<? super E> filterator,
SearchTerm<E>[] searchTerms,
TextSearchStrategy[] filterStrategies,
E element)
element
is matched by all of the given filterStrategies. An optional
filterator can be supplied which is responsible for
extracting all of the filter strings from the given element.
The given filterStrings is passed into this method simply
to avoid reallocating a new List object each time this method is called.
The caller may and should recycle the filterStrings List.filterStrings - a recyclable List into which the filter Strings can storedfilterator - the logic capable of extracting filtering Strings from the elementsearchTerms - SearchTerm objects defining each piece of search text as well as metadata about the textfilterStrategies - the optimized logic for locating given search text within the filterStringselement - the list element on which we are text filteringfilterStrategies located
matching text within the filterStrings extracted from
the given elementpublic static SearchTerm[] normalizeSearchTerms(SearchTerm[] filters, TextSearchStrategy.Factory strategy)
filters by
running each of their characters through the characterMap.
It also removes unnecessary SearchTerms which are not marked as
required.filters - the filter Strings to be normalizedstrategy - the strategy for mapping a characterpublic static <E> SearchTerm<E>[] parse(java.lang.String text)
text and produce an array of
SearchTerm objects that describe text to match as well as
metadata about the way it should be used.text - the raw text entered by a userpublic static <E> SearchTerm<E>[] parse(java.lang.String text, java.util.Set<SearchEngineTextMatcherEditor.Field<E>> fields)
text and produce an array of
SearchTerm objects that describe text to match as well as
metadata about the way it should be used. When parsing the text, the
given Set of SearchEngineTextMatcherEditor.Field objects
should be considered to detect when the user has entered a
field-specific SearchTerm.text - the raw text entered by a userfields - a Set of objects describing each field that can be independently matchedpublic static boolean isMatcherConstrained(TextMatcher oldMatcher, TextMatcher newMatcher)
newMatcher is an absolute
constrainment of oldMatcher, meaning it is guaranteed to
match fewer items than the oldMatcher.oldMatcher - the old TextMatcher being replacednewMatcher - the new TextMatcher to be usednewMatcher is guaranteed to
match the same or fewer items than oldMatcherpublic static boolean isMatcherRelaxed(TextMatcher oldMatcher, TextMatcher newMatcher)
newMatcher is an absolute
relaxation of oldMatcher, meaning it is guaranteed to
match more items than the oldMatcher.oldMatcher - the old TextMatcher being replacednewMatcher - the new TextMatcher to be usednewMatcher is guaranteed to
match the same or more items than oldMatcherGlazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by swimmesberger at Mon Feb 25 11:02:37 CET 2019