本文整理汇总了Java中ca.odell.glazedlists.matchers.Matcher类的典型用法代码示例。如果您正苦于以下问题:Java Matcher类的具体用法?Java Matcher怎么用?Java Matcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Matcher类属于ca.odell.glazedlists.matchers包,在下文中一共展示了Matcher类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findAutoCompleteTerm
import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
/**
* Performs a linear scan of ALL ITEMS, regardless of the filtering state
* of the ComboBoxModel, to locate the autocomplete term. If an exact
* match of the given <code>value</code> can be found, then the item is
* returned. If an exact match cannot be found, the first term that
* <strong>starts with</strong> the given <code>value</code> is returned.
*
* <p>If no exact or partial match can be located, <code>null</code> is
* returned.
*/
private Object findAutoCompleteTerm(String value) {
// determine if our value is empty
final boolean prefixIsEmpty = "".equals(value);
final Matcher<String> valueMatcher = new TextMatcher<String>(new SearchTerm[] {new SearchTerm(value)}, GlazedLists.toStringTextFilterator(), TextMatcherEditor.STARTS_WITH, getTextMatchingStrategy());
Object partialMatchItem = NOT_FOUND;
// search the list of ALL UNFILTERED items for an autocompletion term for the given value
for (int i = 0, n = allItemsUnfiltered.size(); i < n; i++) {
final E item = allItemsUnfiltered.get(i);
final String itemString = convertToString(item);
// if we have an exact match, return the given value immediately
if (value.equals(itemString))
return item;
// if we have not yet located a partial match, check the current itemString for a partial match
// (to be returned if an exact match cannot be found)
if (partialMatchItem == NOT_FOUND) {
if (prefixIsEmpty ? "".equals(itemString) : valueMatcher.matches(itemString))
partialMatchItem = item;
}
}
return partialMatchItem;
}
示例2: filterMovies
import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
/**
* Filter movies.
*
* @param filter
* the filter
*/
public void filterMovies(Map<MovieSearchOptions, Object> filter) {
Matcher<Movie> matcher = new MovieExtendedMatcher(filter);
fireChanged(matcher);
if (MovieModuleManager.MOVIE_SETTINGS.isStoreUiFilters()) {
MovieModuleManager.MOVIE_SETTINGS.setUiFilters(filter);
Globals.settings.saveSettings();
}
}
示例3: StartStopListFilterAction
import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
private StartStopListFilterAction(FilterList<BibEntry> list, Matcher<BibEntry> active, Matcher<BibEntry> inactive) {
this.list = list;
this.active = active;
this.inactive = inactive;
list.setMatcher(inactive);
}
示例4: update
import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
private void update(Matcher<BibEntry> comparator) {
list.getReadWriteLock().writeLock().lock();
try {
list.setMatcher(comparator);
} finally {
list.getReadWriteLock().writeLock().unlock();
}
}
示例5: findAutoCompleteTerm
import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
/**
* Performs a linear scan of ALL ITEMS, regardless of the filtering state of
* the ComboBoxModel, to locate the autocomplete term. If an exact match of
* the given <code>value</code> can be found, then the item is returned. If
* an exact match cannot be found, the first term that <strong>starts
* with</strong> the given <code>value</code> is returned.
* <p/>
* <p/>
* If no exact or partial match can be located, <code>null</code> is
* returned.
*/
@SuppressWarnings("rawtypes")
private Object findAutoCompleteTerm(String value) {
// determine if our value is empty
final boolean prefixIsEmpty = "".equals(value);
final Matcher<String> valueMatcher = new TextMatcher<String>(
new SearchTerm[]{new SearchTerm(value)},
GlazedLists.toStringTextFilterator(),
TextMatcherEditor.STARTS_WITH, getTextMatchingStrategy());
Object partialMatchItem = NOT_FOUND;
// search the list of ALL UNFILTERED items for an autocompletion term
// for the given value
for (int i = 0, n = allItemsUnfiltered.size(); i < n; i++) {
final E item = allItemsUnfiltered.get(i);
final String itemString = convertToString(item);
// if we have an exact match, return the given value immediately
if (value.equals(itemString))
return item;
// if we have not yet located a partial match, check the current
// itemString for a partial match
// (to be returned if an exact match cannot be found)
if (partialMatchItem == NOT_FOUND) {
if (prefixIsEmpty ? "".equals(itemString) : valueMatcher
.matches(itemString))
partialMatchItem = item;
}
}
return partialMatchItem;
}
示例6: InvertMatcher
import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
public InvertMatcher(Matcher<E> matcher) {
this.matcher = matcher;
}
示例7: getMatcher
import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
public Matcher getMatcher() {
return matcher;
}
示例8: containsCast
import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
private boolean containsCast(final Movie movie, final String name) {
if (StringUtils.isNotEmpty(name)) {
Pattern pattern = Pattern.compile("(?i)" + Pattern.quote(name));
java.util.regex.Matcher matcher = null;
// director
if (StringUtils.isNotEmpty(movie.getDirector())) {
matcher = pattern.matcher(movie.getDirector());
if (matcher.find()) {
return true;
}
}
// writer
if (StringUtils.isNotEmpty(movie.getWriter())) {
matcher = pattern.matcher(movie.getWriter());
if (matcher.find()) {
return true;
}
}
// actors
for (MovieActor cast : movie.getActors()) {
if (StringUtils.isNotEmpty(cast.getName())) {
matcher = pattern.matcher(cast.getName());
if (matcher.find()) {
return true;
}
}
}
// producers
for (MovieProducer producer : movie.getProducers()) {
if (StringUtils.isNotEmpty(producer.getName())) {
matcher = pattern.matcher(producer.getName());
if (matcher.find()) {
return true;
}
}
}
}
return false;
}
示例9: matches
import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
private boolean matches(int row, Matcher<BibEntry> m) {
return getBibEntry(row).map(m::matches).orElse(false);
}
示例10: HitOrMissComparator
import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
public HitOrMissComparator(Matcher<BibEntry> hitOrMiss) {
this.hitOrMiss = Objects.requireNonNull(hitOrMiss);
}
示例11: setFilterMatcher
import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
/**
* Set the <code>Matcher</code> to be used in filtering the elements of the master
* set. Note that only one of a Matcher or MatcherEditor may be used, not both. If
* both are specified, then the Matcher will take precedence.
*
* @param matcher The Matcher to use to filter elements in the master set.
*/
public void setFilterMatcher(Matcher matcher) {
this.matcher = matcher;
}
示例12: getFilterMatcher
import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
/**
* Get the <code>Matcher</code> to be used in filtering the elements of the master
* set.
*
* @return matcher
*/
public Matcher getFilterMatcher() {
return matcher;
}