/*
Copyright 2007-2011 Selenium committers

Portions copyright 2011 Software Freedom Conservancy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
 */

package org.openqa.selenium.logging;

import org.openqa.selenium.Beta;

import com.google.common.collect.ImmutableList;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;

/**
 * Represent a pool of {@Link LogEntry}. This class also provides filtering
 * mechanisms based on levels.
 */
@Beta
public class LogEntries implements Iterable<LogEntry> {
  private final List<LogEntry> entries;

  public LogEntries(Iterable<LogEntry> entries) {
    this.entries = ImmutableList.copyOf(entries);
  }

  /**
   * @return a view of all {@link LogEntry} fetched.
   */
  public List<LogEntry> getAll() {
    return entries;
  }

  /**
   * @param level {@link Level} The level to filter the log entries.
   * @return all log entries for that level and above.
   */
  public List<LogEntry> filter(Level level) {
    List<LogEntry> toReturn = new ArrayList<LogEntry>();
    for (LogEntry entry : entries) {
      if (entry.getLevel().intValue() >= level.intValue()) {
        toReturn.add(entry);
      }
    }
    return toReturn;
  }

  public Iterator<LogEntry> iterator() {
    return entries.iterator();
  }
}

@@ -36,17 +36,16 @@
 mitters%0A
-%0A
 Portions
@@ -59,16 +59,21 @@
 ght 2011
+-2012
  Softwar
@@ -620,17 +620,16 @@
 icense.%0A
- 
 */%0A%0Apack
@@ -666,42 +666,8 @@
 g;%0A%0A
-import org.openqa.selenium.Beta;%0A%0A
 impo
@@ -714,36 +714,82 @@
 st;%0A
-%0A
 import 
-java.util.ArrayList;
+com.google.common.collect.Lists;%0A%0Aimport org.openqa.selenium.Beta;%0A
 %0Aimp
@@ -912,16 +912,17 @@
 gEntry%7D.
+ 
  This cl
@@ -948,19 +948,16 @@
 iltering
-%0A *
  mechani
@@ -968,16 +968,19 @@
 based on
+%0A *
  levels.
@@ -1046,16 +1046,17 @@
 ntry%3E %7B%0A
+%0A
   privat
@@ -1195,24 +1195,67 @@
 %0A  %7D%0A%0A  /**%0A
+   * Get the list of all log entries.%0A   *%0A
    * @return
@@ -1293,17 +1293,16 @@
  fetched
-.
 %0A   */%0A 
@@ -1398,17 +1398,17 @@
  Level%7D 
-T
+t
 he level
@@ -1429,25 +1429,24 @@
  log entries
-.
 %0A   * @retur
@@ -1487,17 +1487,16 @@
 nd above
-.
 %0A   */%0A 
@@ -1574,12 +1574,17 @@
 n = 
+Lists.
 new
- 
 Arra
@@ -1592,22 +1592,13 @@
 List
-%3CLogEntry%3E
 ();%0A
+%0A
     
@@ -1730,24 +1730,25 @@
     %7D%0A    %7D%0A
+%0A
     return t
@@ -1837,10 +1837,10 @@
 ();%0A  %7D%0A
-%7D
 %0A
+%7D

Improve documentation of LogEntries