本文整理匯總了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);
}