summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMatthew Khouzam2012-04-10 17:23:59 (EDT)
committer Francois Chouinard2012-04-16 14:20:26 (EDT)
commit7a47bb780be058a2ab9f47b22cd141f808a5580c (patch)
treefa28ed9e5080b08965da79fb941e00127e35f539
parent43ddc7d7856715dab1be8b85eee892ec13733b92 (diff)
downloadorg.eclipse.linuxtools-7a47bb780be058a2ab9f47b22cd141f808a5580c.zip
org.eclipse.linuxtools-7a47bb780be058a2ab9f47b22cd141f808a5580c.tar.gz
org.eclipse.linuxtools-7a47bb780be058a2ab9f47b22cd141f808a5580c.tar.bz2
Fix warnings
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java1
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java1
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java2
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java1
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java13
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java47
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java24
7 files changed, 73 insertions, 16 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java b/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java
index 41977a7..f6daa84 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java
@@ -38,7 +38,6 @@ public class Benchmark {
try {
System.in.read();
} catch (IOException e1) {
- // TODO Auto-generated catch block
e1.printStackTrace();
}
// Work variables
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
index 64a5125..67bf708 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
@@ -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
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java
index 5cab5cb..f70b569 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java
@@ -8,7 +8,7 @@ public class CtfLocation implements ITmfLocation<Long> {
public CtfLocation(Long location) {
setLocation(location);
}
-
+
public CtfLocation(ITmfTimestamp timestamp) {
setLocation(timestamp.getValue());
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java
index 8ca36fe..76a325e 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java
@@ -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;
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java
index 20234a1..c7b71e0 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java
@@ -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
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java
index 276d99d..c919394 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java
@@ -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)
*
@@ -26,6 +62,17 @@ public class CtfTmfTimestamp extends TmfTimestamp implements ITmfTimestamp {
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$
final long nanos = (timestamp % 1000000000);
StringBuilder output = new StringBuilder();
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java
index b55c1e9..c06820f 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java
@@ -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();