From 5b62629afc043030e0cbd4631af7abbdd50fa6bf Mon Sep 17 00:00:00 2001 From: nifi Date: Thu, 9 Sep 2010 19:52:08 +0000 Subject: [PATCH] Updated to use ArrayQueue instead of a linked list for faster random access --- tools/cooja/java/se/sics/cooja/plugins/LogListener.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/plugins/LogListener.java b/tools/cooja/java/se/sics/cooja/plugins/LogListener.java index bac1dd8b5..4c5b407ab 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/LogListener.java +++ b/tools/cooja/java/se/sics/cooja/plugins/LogListener.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: LogListener.java,v 1.31 2010/08/13 10:03:12 fros4943 Exp $ + * $Id: LogListener.java,v 1.32 2010/09/09 19:52:08 nifi Exp $ */ package se.sics.cooja.plugins; @@ -50,7 +50,6 @@ import java.io.FileWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; -import java.util.LinkedList; import java.util.List; import java.util.regex.PatternSyntaxException; @@ -90,6 +89,7 @@ import se.sics.cooja.SimEventCentral.LogOutputEvent; import se.sics.cooja.SimEventCentral.LogOutputListener; import se.sics.cooja.dialogs.TableColumnAdjuster; import se.sics.cooja.dialogs.UpdateAggregator; +import se.sics.cooja.util.ArrayQueue; /** * A simple mote log listener. @@ -116,7 +116,7 @@ public class LogListener extends VisPlugin { private final JTable logTable; private TableRowSorter logFilter; - private LinkedList logs = new LinkedList(); + private ArrayQueue logs = new ArrayQueue(); private Simulation simulation; @@ -155,7 +155,7 @@ public class LogListener extends VisPlugin { /* Remove old */ int removed = 0; while (logs.size() > simulation.getEventCentral().getLogOutputBufferSize()) { - logs.removeFirst(); + logs.remove(0); removed++; } if (removed > 0) {