|
|
@ -673,23 +673,25 @@ public class EntityRule {
|
|
|
|
public EvaluationValue evaluate(
|
|
|
|
public EvaluationValue evaluate(
|
|
|
|
Expression expression, Token operatorToken, EvaluationValue... operands) {
|
|
|
|
Expression expression, Token operatorToken, EvaluationValue... operands) {
|
|
|
|
Log.i("EXPR " + operands[0] + (regex ? " MATCHES " : " CONTAINS ") + operands[1] + " regex=" + regex);
|
|
|
|
Log.i("EXPR " + operands[0] + (regex ? " MATCHES " : " CONTAINS ") + operands[1] + " regex=" + regex);
|
|
|
|
|
|
|
|
|
|
|
|
String condition = operands[1].getStringValue();
|
|
|
|
String condition = operands[1].getStringValue();
|
|
|
|
List<EvaluationValue> array = operands[0].getArrayValue();
|
|
|
|
List<EvaluationValue> array = operands[0].getArrayValue();
|
|
|
|
if (!TextUtils.isEmpty(condition) && array != null) {
|
|
|
|
if (TextUtils.isEmpty(condition) || array == null || array.isEmpty())
|
|
|
|
Pattern p = (regex ? Pattern.compile(condition, Pattern.DOTALL) : null);
|
|
|
|
return expression.convertValue(false);
|
|
|
|
Log.i("EXPR regex=" + (p == null ? null : p.pattern()));
|
|
|
|
|
|
|
|
for (EvaluationValue item : array) {
|
|
|
|
Pattern p = (regex ? Pattern.compile(condition, Pattern.DOTALL) : null);
|
|
|
|
String value = item.getStringValue();
|
|
|
|
for (EvaluationValue item : array) {
|
|
|
|
if (!TextUtils.isEmpty(value))
|
|
|
|
String value = item.getStringValue();
|
|
|
|
if (p == null) {
|
|
|
|
if (!TextUtils.isEmpty(value))
|
|
|
|
if (value.toLowerCase().contains(condition.toLowerCase()))
|
|
|
|
if (p == null) {
|
|
|
|
return expression.convertValue(true);
|
|
|
|
if (value.toLowerCase().contains(condition.toLowerCase()))
|
|
|
|
} else {
|
|
|
|
return expression.convertValue(true);
|
|
|
|
if (p.matcher(value).matches())
|
|
|
|
} else {
|
|
|
|
return expression.convertValue(true);
|
|
|
|
if (p.matcher(value).matches())
|
|
|
|
}
|
|
|
|
return expression.convertValue(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return expression.convertValue(false);
|
|
|
|
return expression.convertValue(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|