(Context context, List<EntityRule> rules,
EntityMessage message, boolean browsed, List<Header> headers, String html)
| 217 | } |
| 218 | |
| 219 | static int run(Context context, List<EntityRule> rules, |
| 220 | EntityMessage message, boolean browsed, List<Header> headers, String html) |
| 221 | throws JSONException, MessagingException, IOException { |
| 222 | int applied = 0; |
| 223 | |
| 224 | List<String> stopped = new ArrayList<>(); |
| 225 | for (EntityRule rule : rules) { |
| 226 | if (rule.group != null && stopped.contains(rule.group)) |
| 227 | continue; |
| 228 | if (rule.matches(context, message, headers, html)) { |
| 229 | if (rule.execute(context, message, browsed, html)) |
| 230 | applied++; |
| 231 | if (rule.stop) |
| 232 | if (rule.group == null) |
| 233 | break; |
| 234 | else { |
| 235 | if (!stopped.contains(rule.group)) |
| 236 | stopped.add(rule.group); |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | return applied; |
| 242 | } |
| 243 | |
| 244 | boolean matches(Context context, EntityMessage message, List<Header> headers, String html) throws MessagingException { |
| 245 | try { |
no test coverage detected