ctf: Fix some Sonar warnings
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / trace / CTFTraceReader.java
index 2aa6afb30def602c8935c73ce5b99ae5d0b6662a..812f6bd36215c3cdfdbf405780177cb7acdd4882 100644 (file)
 
 package org.eclipse.linuxtools.ctf.core.trace;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 import java.util.PriorityQueue;
 import java.util.Set;
-import java.util.Vector;
 
 import org.eclipse.linuxtools.ctf.core.event.EventDefinition;
 import org.eclipse.linuxtools.internal.ctf.core.Activator;
@@ -43,12 +44,12 @@ public class CTFTraceReader {
     /**
      * Vector of all the trace file readers.
      */
-    private final Vector<StreamInputReader> streamInputReaders = new Vector<StreamInputReader>();
+    private final List<StreamInputReader> streamInputReaders = new ArrayList<StreamInputReader>();
 
     /**
      * Priority queue to order the trace file readers by timestamp.
      */
-    protected PriorityQueue<StreamInputReader> prio;
+    private PriorityQueue<StreamInputReader> prio;
 
     /**
      * Array to count the number of event per trace file.
@@ -93,7 +94,7 @@ public class CTFTraceReader {
          * Get the start Time of this trace bear in mind that the trace could be
          * empty.
          */
-        this.startTime = 0;// prio.peek().getPacketReader().getCurrentPacket().getTimestampBegin();
+        this.startTime = 0;
         if (hasMoreEvents()) {
             this.startTime = prio.peek().getCurrentEvent().getTimestamp();
             this.setEndTime(this.startTime);
@@ -146,10 +147,20 @@ public class CTFTraceReader {
      * @param endTime
      *            The end time to use
      */
-    protected void setEndTime(long endTime) {
+    protected final void setEndTime(long endTime) {
         this.endTime = endTime;
     }
 
+    /**
+     * Get the priority queue of this trace reader.
+     *
+     * @return The priority queue of input readers
+     * @since 2.0
+     */
+    protected PriorityQueue<StreamInputReader> getPrio() {
+        return prio;
+    }
+
 
     // ------------------------------------------------------------------------
     // Operations
@@ -330,23 +341,6 @@ public class CTFTraceReader {
         return hasMoreEvents();
     }
 
-//    /**
-//     * Go to the first entry of a trace
-//     *
-//     * @return 0, the first index.
-//     */
-//    private long goToZero() {
-//        long tempIndex;
-//        for (StreamInputReader streamInputReader : this.streamInputReaders) {
-//            /*
-//             * Seek the trace reader.
-//             */
-//            streamInputReader.seek(0);
-//        }
-//        tempIndex = 0;
-//        return tempIndex;
-//    }
-
     /**
      * gets the stream with the oldest event
      *
@@ -361,7 +355,7 @@ public class CTFTraceReader {
      *
      * @return true if yes.
      */
-    public boolean hasMoreEvents() {
+    public final boolean hasMoreEvents() {
         return this.prio.size() > 0;
     }
 
@@ -394,7 +388,8 @@ public class CTFTraceReader {
             long len = (width * this.eventCountPerTraceFile[se.getName()])
                     / numEvents;
 
-            StringBuilder sb = new StringBuilder(se.getFilename() + "\t["); //$NON-NLS-1$
+            StringBuilder sb = new StringBuilder(se.getFilename());
+            sb.append("\t["); //$NON-NLS-1$
 
             for (int i = 0; i < len; i++) {
                 sb.append('+');
This page took 0.025972 seconds and 5 git commands to generate.