ctf: Fix multiple coding style and typo issues while reading code.
authorEtienne Bergeron <etienne.bergeron@gmail.com>
Sun, 17 Nov 2013 03:57:50 +0000 (22:57 -0500)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 26 Nov 2013 20:09:50 +0000 (15:09 -0500)
Change-Id: If63330f4c86e7cd87cf979e1709a81fb7c8958ab
Signed-off-by: Etienne Bergeron <etienne.bergeron@gmail.com>
Reviewed-on: https://git.eclipse.org/r/18541
Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Hudson CI
14 files changed:
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Metadata.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInput.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/EventDeclaration.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/exceptions/ParseException.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/trace/StreamInputPacketIndex.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTree.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIteratorManager.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocationInfo.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfLostEvent.java

index 812f6bd36215c3cdfdbf405780177cb7acdd4882..392900187b5197b79d3fc51559b7a134ae0479ee 100644 (file)
@@ -257,9 +257,6 @@ public class CTFTraceReader {
      * @return True if an event was read.
      */
     public boolean advance() {
-        /*
-         * Index the
-         */
         /*
          * Remove the reader from the top of the priority queue.
          */
@@ -306,15 +303,16 @@ public class CTFTraceReader {
     }
 
     /**
-     * Seeks to a given timestamp It will go to the event just after the
-     * timestamp or the timestamp itself. if a if a trace is 10 20 30 40 and
-     * you're looking for 19, it'll give you 20, it you want 20, you'll get 20,
-     * if you want 21, you'll get 30. You want -inf, you'll get the first
-     * element, you want +inf, you'll get the end of the file with no events.
+     * Seeks to a given timestamp. It will seek to the nearest event greater or
+     * equal to timestamp. If a trace is [10 20 30 40] and you are looking for
+     * 19, it will give you 20. If you want 20, you will get 20, if you want 21,
+     * you will get 30. The value -inf will seek to the first element and the
+     * value +inf will seek to the end of the file (past the last event).
      *
      * @param timestamp
      *            the timestamp to seek to
-     * @return true if the trace has more events following the timestamp
+     * @return true if there are events above or equal the seek timestamp,
+     *         false if seek at the end of the trace (no valid event).
      */
     public boolean seek(long timestamp) {
         /*
@@ -330,19 +328,15 @@ public class CTFTraceReader {
             /*
              * Add it to the priority queue if there is a current event.
              */
-
-        }
-        for (StreamInputReader streamInputReader : this.streamInputReaders) {
             if (streamInputReader.getCurrentEvent() != null) {
                 this.prio.add(streamInputReader);
-
             }
         }
         return hasMoreEvents();
     }
 
     /**
-     * gets the stream with the oldest event
+     * Gets the stream with the oldest event
      *
      * @return the stream with the oldest event
      */
@@ -405,7 +399,7 @@ public class CTFTraceReader {
     }
 
     /**
-     * gets the last event timestamp that was read. This is NOT necessarily the
+     * Gets the last event timestamp that was read. This is NOT necessarily the
      * last event in a trace, just the last one read so far.
      *
      * @return the last event
index 64e50669a3876257b9d2ab9ac2c801fc7ea1e4c7..7c9eed01c6412f2959647f19a10e04f96a0eb302 100644 (file)
@@ -239,8 +239,8 @@ public class Metadata {
     private boolean isPacketBased(FileChannel metadataFileChannel)
             throws CTFReaderException {
         /*
-         * Create a ByteBuffer to read the TSDL magic number (default is big
-         * endian)
+         * Create a ByteBuffer to read the TSDL magic number (default is
+         * big-endian)
          */
         ByteBuffer magicByteBuffer = ByteBuffer.allocate(Utils.TSDL_MAGIC_LEN);
 
@@ -260,7 +260,7 @@ public class Metadata {
             return true;
         }
 
-        /* Try the same thing, but with little endian */
+        /* Try the same thing, but with little-endian */
         magicByteBuffer.order(ByteOrder.LITTLE_ENDIAN);
         magic = magicByteBuffer.getInt(0);
 
index d8ad3d6c0a77355aeb26544a1094cebc5ecaeba7..43d13ded8809bd5e724a599dd2d9b2cf3bf2643a 100644 (file)
@@ -115,7 +115,7 @@ public class StreamInput implements IDefinitionScope {
     }
 
     /**
-     * the common streamInput Index
+     * The common streamInput Index
      *
      * @return the stream input Index
      */
@@ -125,7 +125,7 @@ public class StreamInput implements IDefinitionScope {
 
     /**
      * Gets the filechannel of the streamInput. This is a limited Java
-     * ressource.
+     * resource.
      *
      * @return the filechannel
      */
@@ -143,7 +143,7 @@ public class StreamInput implements IDefinitionScope {
     }
 
     /**
-     * gets the last read timestamp of a stream. (this is not necessarily the
+     * Gets the last read timestamp of a stream. (this is not necessarily the
      * last time in the stream.)
      *
      * @return the last read timestamp
@@ -164,7 +164,7 @@ public class StreamInput implements IDefinitionScope {
     }
 
     /**
-     * useless for streaminputs
+     * Useless for streaminputs
      */
     @Override
     public String getPath() {
@@ -352,7 +352,6 @@ public class StreamInput implements IDefinitionScope {
                 throw new CTFReaderException(
                         "CTF magic mismatch " + Integer.toHexString(magic) + " vs " + Integer.toHexString(Utils.CTF_MAGIC)); //$NON-NLS-1$//$NON-NLS-2$
             }
-
         }
 
         /*
@@ -457,7 +456,7 @@ public class StreamInput implements IDefinitionScope {
 
         /* Read the end timestamp */
         if (tsEnd != null) {
-            if( tsEnd == -1 ) {
+            if (tsEnd == -1) {
                 tsEnd = Long.MAX_VALUE;
             }
             packetIndex.setTimestampEnd(tsEnd.longValue());
index 0d6641ceb4034f4490fa27ca48b1d836a89bbf54..fdedf042f2c837076449afe6e858b95af29b1201 100644 (file)
@@ -110,7 +110,7 @@ public class StreamInputReader {
     }
 
     /**
-     * gets the current packet context
+     * Gets the current packet context
      *
      * @return the current packet context (size, lost events and such)
      */
@@ -248,7 +248,6 @@ public class StreamInputReader {
                 if (this.streamInput.addPacketHeaderIndex()) {
                     packetIndex = getPacketSize() - 1;
                     this.packetReader.setCurrentPacket(getPacket());
-
                 } else {
                     this.packetReader.setCurrentPacket(null);
                 }
@@ -268,7 +267,7 @@ public class StreamInputReader {
 
     /**
      * Changes the location of the trace file reader so that the current event
-     * is the first event with a timestamp greater than the given timestamp.
+     * is the first event with a timestamp greater or equal the given timestamp.
      *
      * @param timestamp
      *            The timestamp to seek to.
@@ -296,9 +295,11 @@ public class StreamInputReader {
         }
 
         /*
-         * Advance until A. we reached the end of the trace file (which means
-         * the given timestamp is after the last event), or B. we found the
-         * first event with a timestamp greater than the given timestamp.
+         * Advance until either of these conditions are met
+         * <ul>
+         *   <li> reached the end of the trace file (the given timestamp is after the last event), </li>
+         *   <li> found the first event with a timestamp greater or equal the given timestamp. </li>
+         * </ul>
          */
         readNextEvent();
         boolean done = (this.getCurrentEvent() == null);
index fa00efe121345ddcf42d617fb8fe84c9dd19dce8..27848e2ab6a6a42e97659b5fd5721fc8afeb7b07 100644 (file)
@@ -171,7 +171,7 @@ public class EventDeclaration implements IEventDeclaration {
     }
 
     /**
-     * Sets the id of am event declaration
+     * Sets the id of an event declaration
      *
      * @param id
      *            the id
@@ -186,7 +186,7 @@ public class EventDeclaration implements IEventDeclaration {
     }
 
     /**
-     * Sets the stream of am event declaration
+     * Sets the stream of an event declaration
      *
      * @param stream
      *            the stream
index 13f27d5f4a29e3bd0c27b240cabf9a15b9f589e8..d31d3634e1e62c8dd38ea95b5119201a19afe447 100644 (file)
@@ -72,7 +72,7 @@ public class IOStructGen {
     // ------------------------------------------------------------------------
 
     /**
-     * Constuctor
+     * Constructor
      *
      * @param tree
      *            the tree (ANTLR generated) with the parsed TSDL data.
@@ -256,7 +256,7 @@ public class IOStructGen {
 
         for (CommonTree child : children) {
             String left;
-            /* this is a regex to find the leading and trailing quotes*/
+            /* this is a regex to find the leading and trailing quotes */
             final String regex = "^\"|\"$"; //$NON-NLS-1$
             /* this is to replace the previous quotes with nothing... effectively deleting them */
             final String nullString = ""; //$NON-NLS-1$
index 9b11d0627152714034a2b3ddc0ab25e86df41b19..7a56912fb2963adfecd2383f115005d48aac637c 100644 (file)
@@ -30,7 +30,7 @@ public class ParseException extends Exception {
     /**
      * Constructor
      *
-     * @param message (to be sent to logs
+     * @param message to be sent to logs
      */
     public ParseException(String message) {
         super(message);
index 5532ad04faa84bc853ae53f44c54ef0f9990de90..50c73ed3139f89b3d09d0917bf4947ec07a209fa 100644 (file)
@@ -84,26 +84,25 @@ public class StreamInputPacketIndex {
     public void addEntry(StreamInputPacketIndexEntry entry)
             throws CTFReaderException {
         assert (entry.getContentSizeBits() != 0);
-        assert (entry.getContentSizeBits() != 0);
 
+        /* Validate consistent entry. */
         if (entry.getTimestampBegin() > entry.getTimestampEnd()) {
             throw new CTFReaderException("Packet begin timestamp is after end timestamp"); //$NON-NLS-1$
         }
 
+        /* Validate entries are inserted in monotonic increasing timestamp order. */
         if (!this.entries.isEmpty()) {
             if (entry.getTimestampBegin() < this.entries.lastElement()
                     .getTimestampBegin()) {
                 throw new CTFReaderException("Packets begin timestamp decreasing"); //$NON-NLS-1$
             }
         }
-
         this.entries.add(entry);
     }
 
     /**
-     * This method returns the first packet with the end timestamp greater
-     * or equal to the given timestamp. The returned packet is the first one
-     * that could include the timestamp.
+     * Returns the first PacketIndexEntry that could include the timestamp,
+     * that is the last packet with a begin timestamp smaller than the given timestamp.
      *
      * @param timestamp
      *            The timestamp to look for.
index f5284048c64d8ccf3f9a5b675f9c80d44b20b23a..fa2378b8a8cfe044c2d5ba7df8472d76cc062968 100644 (file)
@@ -59,7 +59,7 @@ class HistoryTree {
     private final HT_IO treeIO;
 
     // ------------------------------------------------------------------------
-    // Variable Fields (will change throughout the existance of the SHT)
+    // Variable Fields (will change throughout the existence of the SHT)
     // ------------------------------------------------------------------------
 
     /** Latest timestamp found in the tree (at any given moment) */
index 0f250a99c035d4aa4c5e3da3c6ce94a4570b265c..753ff29b38c962f2abe8c45b4ca653d12d1a0e25 100644 (file)
@@ -85,7 +85,6 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
         } else {
             setUnknownLocation();
         }
-
     }
 
     /**
@@ -157,7 +156,7 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
                 this.advance();
             }
         } else {
-            ret= false;
+            ret = false;
         }
         /* Seek the current location accordingly */
         if (ret) {
@@ -165,6 +164,7 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
         } else {
             curLocation = NULL_LOCATION;
         }
+
         return ret;
     }
 
@@ -233,7 +233,7 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
     @Override
     public void increaseRank() {
         /* Only increase the rank if it's valid */
-        if(hasValidRank()) {
+        if (hasValidRank()) {
             curRank++;
         }
     }
index 65fac21e59080277a60dded2c8dec51d633085ac..afe436d121147c2250679ceb75ee3c5233ed8b20 100644 (file)
@@ -139,7 +139,7 @@ class CtfTraceManager {
      *
      * @param context
      *            the context to look up
-     * @return the iterator refering to the context
+     * @return the iterator referring to the context
      */
     public CtfIterator getIterator(final CtfTmfContext context) {
         /*
index 55acb6b584382a21a33ff39af0dfd5142b6136ce..c33d6c2e69d3002da80c623cbb6b19b900cc7223 100644 (file)
@@ -143,6 +143,5 @@ public final class CtfLocation extends TmfLocation {
     @Override
     public void serialize(ByteBuffer bufferOut) {
         getLocationInfo().serialize(bufferOut);
-
     }
 }
index 7a3c4678159f4809cb523253fb9607fa9c05f594..cb974929af3cb0ff8c265ad899b473777223db2f 100644 (file)
@@ -133,6 +133,5 @@ public class CtfLocationInfo implements Comparable<CtfLocationInfo> {
     public void serialize(ByteBuffer bufferOut) {
         bufferOut.putLong(timestamp);
         bufferOut.putLong(index);
-
     }
 }
index fb50df7014b5ced82d4d0c9c32499cccbda8fe53..05834bdb1e5ce9535e406b40c32ca8717c882496 100644 (file)
@@ -40,7 +40,7 @@ public class CtfTmfLostEvent extends CtfTmfEvent implements ITmfLostEvent {
      * @param fileName
      *            The name of the trace file from which this event comes
      * @param cpu
-     *            The CPU on which this event happend
+     *            The CPU on which this event happened
      * @param declaration
      *            The CTF Event Declaration object that created this event
      * @param timeRange
@@ -75,5 +75,4 @@ public class CtfTmfLostEvent extends CtfTmfEvent implements ITmfLostEvent {
         return fNbLost;
     }
 
-
 }
This page took 0.034829 seconds and 5 git commands to generate.