Temporary fix for multiple search terms being treated as one.

This commit is contained in:
Krazy
2014-08-19 21:24:36 +00:00
parent abed6a4024
commit 3f35cb25c3

View File

@@ -35,11 +35,15 @@ public class SFilterUtil {
return Predicates.alwaysTrue();
}
BooleanExpression expression = new BooleanExpression(text, inName, inType, inText, inCost);
if (BooleanExpression.isExpression(text)) {
BooleanExpression expression = new BooleanExpression(text, inName, inType, inText, inCost);
Predicate<CardRules> filter = expression.evaluate();
if (filter != null) {
return Predicates.compose(invert ? Predicates.not(filter) : filter, PaperCard.FN_GET_RULES);
}
Predicate<CardRules> filter = expression.evaluate();
if (filter != null) {
return Predicates.compose(invert ? Predicates.not(filter) : filter, PaperCard.FN_GET_RULES);
}
String[] splitText = text.replaceAll(",", "").replaceAll(" ", " ").split(" ");
@@ -123,6 +127,10 @@ public class SFilterUtil {
parse();
}
private static boolean isExpression(String text) {
return text.contains(Operation.AND.token) || text.contains(Operation.OR.token);
}
private void parse() {
Tokenizer tokenizer = new Tokenizer(text);