当前位置: 首页>>代码示例>>Java>>正文


Java Matcher类代码示例

本文整理汇总了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;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:38,代码来源:SearchAutoCompleteSupport.java

示例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();
  }
}
 
开发者ID:tinyMediaManager,项目名称:tinyMediaManager,代码行数:15,代码来源:MovieMatcherEditor.java

示例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);
}
 
开发者ID:JabRef,项目名称:jabref,代码行数:8,代码来源:MainTableDataModel.java

示例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();
    }
}
 
开发者ID:JabRef,项目名称:jabref,代码行数:9,代码来源:MainTableDataModel.java

示例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;
}
 
开发者ID:richard-strauss-werke,项目名称:glyphpicker,代码行数:40,代码来源:CustomAutoCompleteSupport.java

示例6: InvertMatcher

import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
public InvertMatcher(Matcher<E> matcher) {
	this.matcher = matcher;
}
 
开发者ID:GoldenGnu,项目名称:jwarframe,代码行数:4,代码来源:InvertMatcher.java

示例7: getMatcher

import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
public Matcher getMatcher() {
	return matcher;
}
 
开发者ID:mongkoy,项目名称:c-logger,代码行数:4,代码来源:QuickFilterMatcherEditor.java

示例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;
}
 
开发者ID:tinyMediaManager,项目名称:tinyMediaManager,代码行数:44,代码来源:MovieExtendedMatcher.java

示例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);
}
 
开发者ID:JabRef,项目名称:jabref,代码行数:4,代码来源:MainTable.java

示例10: HitOrMissComparator

import ca.odell.glazedlists.matchers.Matcher; //导入依赖的package包/类
public HitOrMissComparator(Matcher<BibEntry> hitOrMiss) {
    this.hitOrMiss = Objects.requireNonNull(hitOrMiss);
}
 
开发者ID:JabRef,项目名称:jabref,代码行数:4,代码来源:HitOrMissComparator.java

示例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;
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:11,代码来源:AbstractTableMasterForm.java

示例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;
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:10,代码来源:AbstractTableMasterForm.java


注:本文中的ca.odell.glazedlists.matchers.Matcher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。