public boolean evaluate()

in src/main/java/org/apache/log4j/rule/OrRule.java [90:125]


  public boolean evaluate(final ChainsawLoggingEvent event, Map matches) {
      if (matches == null) {
        return (rule1.evaluate(event, null) || rule2.evaluate(event, null));
      }
      Map tempMatches1 = new HashMap();
      Map tempMatches2 = new HashMap();
      //not short-circuiting because we want to build the matches list
      boolean result1 = rule1.evaluate(event, tempMatches1);
      boolean result2 = rule2.evaluate(event, tempMatches2);
      boolean result = result1 || result2;
      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;
  }