Fix warnings
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Tue, 10 Apr 2012 21:23:59 +0000 (17:23 -0400)
committerFrancois Chouinard <fchouinard@gmail.com>
Mon, 16 Apr 2012 18:20:26 +0000 (14:20 -0400)
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.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/CtfLocation.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java

index 41977a7bb46936400fa19744780cc13893a96db1..f6daa8473fe5bbcbb3dd1a12eceb5ff5474205b7 100644 (file)
@@ -38,7 +38,6 @@ public class Benchmark {
         try {
             System.in.read();
         } catch (IOException e1) {
-            // TODO Auto-generated catch block
             e1.printStackTrace();
         }
         // Work variables
index 64a51252c127129d48258c928aab740c2eae4f92..67bf70891bb8faa7f823485dd9022623dda54dbe 100644 (file)
@@ -119,6 +119,7 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
         return curLocation;
     }
 
+    @SuppressWarnings("unused")
     @Override
     public void updateRank(int rank) {
         // not needed I think
index 5cab5cb62fa973210e8635bc5665cfe8fb753ee6..f70b569df2f1ebc99b4ef63afb2291b5282f7db1 100644 (file)
@@ -8,7 +8,7 @@ public class CtfLocation implements ITmfLocation<Long> {
     public CtfLocation(Long location) {
         setLocation(location);
     }
-    
+
     public CtfLocation(ITmfTimestamp timestamp) {
         setLocation(timestamp.getValue());
     }
index 8ca36fe46cafac1bacfdaf5359cff7a007a9db9a..76a325e0a5dd7854a76ce990736d603c0d6cfd16 100644 (file)
@@ -20,7 +20,6 @@ import org.eclipse.linuxtools.ctf.core.event.EventDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.Definition;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
 import org.eclipse.linuxtools.ctf.core.trace.StreamInputReader;
-import org.eclipse.linuxtools.internal.tmf.core.TmfCorePlugin;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEventType;
index 20234a1fde71c9237c9d156607b884c6aeb923e8..c7b71e02ba8430929240bde4e49c11699f87a58e 100644 (file)
@@ -138,7 +138,7 @@ public abstract class CtfTmfEventField implements ITmfEventField {
 
     /**
      * Return the int representing this field's value type
-     * 
+     *
      * @return the field type
      */
     public abstract int getFieldType();
@@ -146,7 +146,7 @@ public abstract class CtfTmfEventField implements ITmfEventField {
     /**
      * Return this field's value. You can cast it to the correct type depending
      * on what getFieldType says.
-     * 
+     *
      * @return the field value
      */
     @Override
@@ -155,7 +155,7 @@ public abstract class CtfTmfEventField implements ITmfEventField {
     /**
      * Other methods defined by ITmfEventField, but not used here: the CTF
      *       fields do not have sub-fields (yet!)
-     * 
+     *
      * @return the field names
      */
     @Override
@@ -163,6 +163,7 @@ public abstract class CtfTmfEventField implements ITmfEventField {
         return null;
     }
 
+    @SuppressWarnings("unused")
     @Override
     public String getFieldName(int index) {
         return null;
@@ -173,11 +174,13 @@ public abstract class CtfTmfEventField implements ITmfEventField {
         return null;
     }
 
+    @SuppressWarnings("unused")
     @Override
     public ITmfEventField getField(String fieldName) {
         return null;
     }
 
+    @SuppressWarnings("unused")
     @Override
     public ITmfEventField getField(int index) {
         return null;
@@ -212,7 +215,7 @@ final class CTFIntegerField extends CtfTmfEventField {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.lang.Object#toString()
      */
     @Override
@@ -245,7 +248,7 @@ final class CTFStringField extends CtfTmfEventField {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.lang.Object#toString()
      */
     @Override
index 276d99de52664e1ba40cb5d6d0b65c0e19c64aa9..c9193943bdcac7443e86f7c00ac52a9cabd89df4 100644 (file)
@@ -17,6 +17,42 @@ public class CtfTmfTimestamp extends TmfTimestamp implements ITmfTimestamp {
         fScale = (byte) -9;
     }
 
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = (prime * result) + ((fTrace == null) ? 0 : fTrace.hashCode());
+        return result;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (!(obj instanceof CtfTmfTimestamp)) {
+            return false;
+        }
+        CtfTmfTimestamp other = (CtfTmfTimestamp) obj;
+        if (fTrace == null) {
+            if (other.fTrace != null) {
+                return false;
+            }
+        } else if (!fTrace.equals(other.fTrace)) {
+            return false;
+        }
+        return true;
+    }
+
     /*
      * (non-Javadoc)
      *
@@ -24,6 +60,17 @@ public class CtfTmfTimestamp extends TmfTimestamp implements ITmfTimestamp {
      */
     @Override
     public String toString() {
+        final long timestamp = fValue;
+        final Date d = new Date(timestamp / 1000000);
+        final DateFormat df = new SimpleDateFormat("HH:mm:ss."); //$NON-NLS-1$
+        final long nanos = (timestamp % 1000000000);
+        StringBuilder output = new StringBuilder();
+        output.append(df.format(d));
+        output.append(String.format("%09d", nanos)); //$NON-NLS-1$
+        return output.toString();
+    }
+
+    public String toFullDateString(){
         final long timestamp = fValue;
         final Date d = new Date(timestamp / 1000000);
         final DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss."); //$NON-NLS-1$
index b55c1e970fc9e7371b9d0f8ee21195eeef780eca..c06820f488e23474eccae26c306fb56a470a037e 100644 (file)
@@ -57,6 +57,7 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements
         super();
     }
 
+    @SuppressWarnings("unused")
     @Override
     public void initTrace(String name, String path, Class<CtfTmfEvent> eventType)
             throws FileNotFoundException {
@@ -68,7 +69,6 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements
              * was not found or was not recognized as a CTF trace. Throw into
              * the new type of exception expected by the rest of TMF.
              */
-            System.err.println("Cannot find file " + path); //$NON-NLS-1$
             throw new FileNotFoundException(e.getMessage());
         }
         this.iterator = new CtfIterator(this, 0, 0);
@@ -83,8 +83,10 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements
         // this.fEndTime.clone()));
     }
 
+    @SuppressWarnings("unused")
     @Override
     public void indexTrace(boolean waitForCompletion) {
+        // do nothing
     }
 
     @Override
@@ -97,6 +99,7 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements
         TmfSignalManager.dispatchSignal(signal);
     }
 
+    @SuppressWarnings("unused")
     @Override
     public boolean validate(IProject project, String path) {
         try {
@@ -223,6 +226,7 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements
      * FIXME merge with getNextEvent below once they both use the same parameter
      * type.
      */
+    @SuppressWarnings("unused")
     @Override
     public CtfTmfEvent getNext(ITmfContext context) {
         iterator.advance();
@@ -235,19 +239,21 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements
 
     @Override
     public ITmfContext seekLocation(ITmfLocation<?> location) {
-        if (location == null) {
-            location = new CtfLocation(0L);
+        CtfLocation currentLocation = (CtfLocation) location;
+        if (currentLocation == null) {
+            currentLocation = new CtfLocation(0L);
         }
-        iterator.setLocation(location);
+        iterator.setLocation(currentLocation);
         return iterator;
     }
 
     @Override
     public double getLocationRatio(ITmfLocation<?> location) {
-        CtfIterator curLocation = (CtfIterator) location;
-        return ((double) curLocation.getCurrentEvent().getTimestampValue() - curLocation
+        CtfLocation curLocation = (CtfLocation) location;
+        iterator.seek(curLocation.getLocation());
+        return ((double) iterator.getCurrentEvent().getTimestampValue() - iterator
                 .getStartTime())
-                / (curLocation.getEndTime() - curLocation.getStartTime());
+                / (iterator.getEndTime() - iterator.getStartTime());
     }
 
     @Override
@@ -279,12 +285,14 @@ public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements
         return iterator;
     }
 
+    @SuppressWarnings("unused")
     @Override
-    public CtfTmfEvent getNextEvent(ITmfContext context) {
+    public CtfTmfEvent getNextEvent( ITmfContext context) {
         iterator.advance();
         return iterator.getCurrentEvent();
     }
 
+    @SuppressWarnings("unused")
     @Override
     public CtfTmfEvent parseEvent(ITmfContext context) {
         return iterator.getCurrentEvent();
This page took 0.0301670000000001 seconds and 5 git commands to generate.