本文整理汇总了Java中codechicken.nei.ItemList.PatternItemFilter类的典型用法代码示例。如果您正苦于以下问题:Java PatternItemFilter类的具体用法?Java PatternItemFilter怎么用?Java PatternItemFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PatternItemFilter类属于codechicken.nei.ItemList包,在下文中一共展示了PatternItemFilter类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFilter
import codechicken.nei.ItemList.PatternItemFilter; //导入依赖的package包/类
@Override
public ItemFilter getFilter() {
String s_filter = text().toLowerCase();
for(ISearchProvider p : searchProviders) {
ItemFilter filter = p.getFilter(s_filter);
if(filter != null)
return filter;
}
switch(NEIClientConfig.getIntSetting("inventory.searchmode")) {
case 0://plain
s_filter = "\\Q"+s_filter+"\\E";
break;
case 1:
s_filter = s_filter
.replace(".", "")
.replace("?", ".")
.replace("*", ".+?");
break;
}
Pattern pattern = null;
try {
pattern = Pattern.compile(s_filter);
} catch (PatternSyntaxException ignored) {}
if (pattern == null || pattern.toString().equals(""))
return new EverythingItemFilter();
return new PatternItemFilter(pattern);
}
示例2: getFilter
import codechicken.nei.ItemList.PatternItemFilter; //导入依赖的package包/类
@Override
public ItemFilter getFilter(String searchText) {
Pattern pattern = getPattern(searchText);
return pattern == null ? null : new PatternItemFilter(pattern);
}