public boolean evaluate()

in src/main/java/org/apache/log4j/rule/AndRule.java [93:125]


  public boolean evaluate(final ChainsawLoggingEvent event, Map matches) {
        if (matches == null) {
            return firstRule.evaluate(event, null) && secondRule.evaluate(event, null);
        }
        Map tempMatches1 = new HashMap();
        Map tempMatches2 = new HashMap();
        boolean result = firstRule.evaluate(event, tempMatches1) && secondRule.evaluate(event, tempMatches2);
        if (result) {
            for (Iterator iter = tempMatches1.entrySet().iterator();iter.hasNext();) {
                Map.Entry entry = (Map.Entry)iter.next();
                Object key = entry.getKey();
                Set value = (Set)entry.getValue();
                Set mainSet = (Set) matches.get(key);
                if (mainSet == null) {
                    mainSet = new HashSet();
                    matches.put(key, mainSet);
                }
                mainSet.addAll(value);
            }
            for (Iterator iter = tempMatches2.entrySet().iterator();iter.hasNext();) {
                Map.Entry entry = (Map.Entry)iter.next();
                Object key = entry.getKey();
                Set value = (Set)entry.getValue();
                Set mainSet = (Set) matches.get(key);
                if (mainSet == null) {
                    mainSet = new HashSet();
                    matches.put(key, mainSet);
                }
                mainSet.addAll(value);
            }
        }
        return result;
  }