rcp: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.ctf.core / src / org / eclipse / tracecompass / tmf / ctf / core / event / CtfTmfEvent.java
index bf060afa7fad4df9d45d50fe7fc6f1e7e2673ac4..334b7409efd1fa60e4219fc10a6c8e5265a59405 100644 (file)
@@ -19,12 +19,10 @@ import java.util.List;
 import java.util.Set;
 
 import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
 import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
 import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
 import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
 import org.eclipse.tracecompass.tmf.core.event.ITmfCustomAttributes;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
@@ -32,19 +30,17 @@ import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfModelLookup;
 import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfSourceLookup;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.ctf.core.CtfConstants;
 import org.eclipse.tracecompass.tmf.ctf.core.event.lookup.CtfTmfCallsite;
-import org.eclipse.tracecompass.tmf.ctf.core.timestamp.CtfTmfTimestamp;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
 
 /**
  * A wrapper class around CTF's Event Definition/Declaration that maps all types
  * of Declaration to native Java types.
  *
- * @version 1.0
  * @author Alexandre Montplaisir
- * @since 2.0
  */
 public class CtfTmfEvent extends TmfEvent
         implements ITmfSourceLookup, ITmfModelLookup, ITmfCustomAttributes {
@@ -78,7 +74,7 @@ public class CtfTmfEvent extends TmfEvent
     /**
      * Constructor used by {@link CtfTmfEventFactory#createEvent}
      */
-    CtfTmfEvent(CtfTmfTrace trace, long rank, CtfTmfTimestamp timestamp,
+    CtfTmfEvent(CtfTmfTrace trace, long rank, TmfNanoTimestamp timestamp,
             String fileName, int cpu, IEventDeclaration declaration, @NonNull EventDefinition eventDefinition) {
         super(trace,
                 rank,
@@ -116,7 +112,7 @@ public class CtfTmfEvent extends TmfEvent
     CtfTmfEvent(CtfTmfTrace trace) {
         super(trace,
                 ITmfContext.UNKNOWN_RANK,
-                new CtfTmfTimestamp(-1),
+                new TmfNanoTimestamp(-1),
                 null,
                 new TmfEventField("", null, new CtfTmfEventField[0])); //$NON-NLS-1$
         fSourceCPU = -1;
@@ -193,9 +189,11 @@ public class CtfTmfEvent extends TmfEvent
         return fCtfTmfEventType;
     }
 
-    /**
-     * @since 2.0
-     */
+    @Override
+    public String getName() {
+        return fEventName;
+    }
+
     @Override
     public Set<String> listCustomAttributes() {
         if (fEventDeclaration == null) {
@@ -204,9 +202,6 @@ public class CtfTmfEvent extends TmfEvent
         return fEventDeclaration.getCustomAttributes();
     }
 
-    /**
-     * @since 2.0
-     */
     @Override
     public String getCustomAttribute(String name) {
         if (fEventDeclaration == null) {
@@ -219,36 +214,25 @@ public class CtfTmfEvent extends TmfEvent
      * Get the call site for this event.
      *
      * @return the call site information, or null if there is none
-     * @since 2.0
      */
     @Override
     public CtfTmfCallsite getCallsite() {
-        CTFCallsite callsite = null;
+        CtfTmfCallsite callsite = null;
         CtfTmfTrace trace = getTrace();
-        CTFTrace ctfTrace = trace.getCTFTrace();
-        /* Should not happen, but it is a good check */
-        if (ctfTrace == null) {
-            return null;
-        }
+
         if (getContent() != null) {
             ITmfEventField ipField = getContent().getField(CtfConstants.CONTEXT_FIELD_PREFIX + CtfConstants.IP_KEY);
             if (ipField != null && ipField.getValue() instanceof Long) {
                 long ip = (Long) ipField.getValue();
-                callsite = ctfTrace.getCallsite(fEventName, ip);
+                callsite = trace.getCallsite(fEventName, ip);
             }
         }
         if (callsite == null) {
-            callsite = ctfTrace.getCallsite(fEventName);
+            callsite = trace.getCallsite(fEventName);
         }
-        if (callsite != null) {
-            return new CtfTmfCallsite(callsite);
-        }
-        return null;
+        return callsite;
     }
 
-    /**
-     * @since 2.0
-     */
     @Override
     public String getModelUri() {
         return getCustomAttribute(CtfConstants.MODEL_URI_KEY);
This page took 0.027101 seconds and 5 git commands to generate.