@Override
  public List<RuleMatch> filter(List<RuleMatch> ruleMatches) {
    Collections.sort(ruleMatches);
    List<RuleMatch> filteredRules = new ArrayList<>();
    for (int i = 0; i < ruleMatches.size(); i++) {
      RuleMatch match = ruleMatches.get(i);
      while (i < ruleMatches.size() - 1 && overlapAndMatch(match, ruleMatches.get(i + 1))) {
        i++;  // skip next match
      }
      filteredRules.add(match);
    }
    return filteredRules;
  }
@ Override public List < RuleMatch > filter ( List < RuleMatch > ruleMatches ) { Collections . sort ( ruleMatches ) ; List < RuleMatch > filteredRules = new ArrayList < > ( ) ; for ( int i = 0 ; i < ruleMatches . size ( ) ; i ++ ) { RuleMatch match = ruleMatches . get ( i ) ; while ( i < ruleMatches . size ( ) - 1 && overlapAndMatch ( match , ruleMatches . get ( i + 1 ) ) ) { i ++ ; } filteredRules . add ( match ) ; } return filteredRules ; }
@param ruleMatches list of matches