class QueueCircuitBreakerRulePatternToCircuitMapping {

    public List<PatternAndCircuitHash> updateRulePatternToCircuitMapping(List<Rule> rules){
        List<PatternAndCircuitHash> originalPatternAndCircuitHashes = new ArrayList<>(rulePatternToCircuitMapping);
        log.debug("clearing rule pattern to circuit mapping values");
        rulePatternToCircuitMapping.clear();
        log.debug("new rule pattern to circuit mapping values are:");
        for (Rule rule : rules) {
            PatternAndCircuitHash patternAndCircuitHash = getPatternAndCircuitHashFromRule(rule);
            if(patternAndCircuitHash != null){
                log.debug(patternAndCircuitHash.toString());
                rulePatternToCircuitMapping.add(patternAndCircuitHash);
            } else {
                log.error("rule pattern and circuitHash could not be retrieved from rule " + rule.getUrlPattern());
            }
        }
        return getRemovedPatternAndCircuitHashes(originalPatternAndCircuitHashes, rulePatternToCircuitMapping);
    }

}