tmf.core: Internalize timestamp types
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Tue, 19 Apr 2016 03:12:23 +0000 (23:12 -0400)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Mon, 25 Apr 2016 13:26:22 +0000 (09:26 -0400)
Move timestamp implementations to an internal package.

Change-Id: I2705c11a4a2cf91204854e726c798c37b30bec6a
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/70246
Reviewed-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/model/TmfXmlAction.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/event/TmfNanoTimestampTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/event/TmfSecondTimestampTest.java
tmf/org.eclipse.tracecompass.tmf.core/META-INF/MANIFEST.MF
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/timestamp/TmfNanoTimestamp.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/timestamp/TmfSecondTimestamp.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/timestamp/package-info.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfNanoTimestamp.java [deleted file]
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfSecondTimestamp.java [deleted file]
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfTimestamp.java

index cc38801e570979140057a367afd5eae82931641e..7f97ab3c3f2d6d78826ff6a1eb61fddd575c560c 100644 (file)
@@ -23,7 +23,7 @@ import org.eclipse.tracecompass.tmf.analysis.xml.core.module.XmlUtils;
 import org.eclipse.tracecompass.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.w3c.dom.Element;
 
 /**
@@ -157,7 +157,7 @@ public class TmfXmlAction implements ITmfXmlAction {
         public void execute(ITmfEvent event, TmfXmlScenarioInfo scenarioInfo) {
             long ts = fProvider.getHistoryBuilder().getStartTime(fProvider, scenarioInfo, event);
             // FIXME Should the scale always be nanoseconds?
-            ITmfTimestamp start = new TmfNanoTimestamp(ts);
+            ITmfTimestamp start = TmfTimestamp.fromNanos(ts);
             ITmfTimestamp end = event.getTimestamp();
             fSegmentBuilder.generatePatternSegment(event, start, end, scenarioInfo);
         }
index a51ff90bbdce4db1b23e7ebcdc424a0e5cba4c35..a3a797199293d765af53f3cd49d3a0e460cdd532 100644 (file)
@@ -21,8 +21,8 @@ import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+import org.eclipse.tracecompass.internal.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.junit.Test;
 
index dd18f042b85c6a257f35a7cdd2f6985342cb2ead..8f65ef3401f60e0c40f2d0e57acdd0f7f9c8e718 100644 (file)
@@ -21,8 +21,8 @@ import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+import org.eclipse.tracecompass.internal.tmf.core.timestamp.TmfSecondTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfSecondTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.junit.Test;
 
index ebb96a8e3fdbbd8d2ab83b3981736459446f94d3..6a6ac60669791b4ee5a6e4f22f60eb654b9b62c4 100644 (file)
@@ -26,6 +26,7 @@ Export-Package: org.eclipse.tracecompass.internal.tmf.core;x-friends:="org.eclip
  org.eclipse.tracecompass.internal.tmf.core.statesystem.mipmap;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
  org.eclipse.tracecompass.internal.tmf.core.synchronization;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
  org.eclipse.tracecompass.internal.tmf.core.synchronization.graph;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
+ org.eclipse.tracecompass.internal.tmf.core.timestamp;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
  org.eclipse.tracecompass.internal.tmf.core.trace.experiment;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
  org.eclipse.tracecompass.internal.tmf.core.trace.indexer;x-friends:="org.eclipse.tracecompass.tmf.core.tests",
  org.eclipse.tracecompass.tmf.core,
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/timestamp/TmfNanoTimestamp.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/timestamp/TmfNanoTimestamp.java
new file mode 100644 (file)
index 0000000..c047177
--- /dev/null
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Francois Chouinard - Initial API and implementation
+ *   Patrick Tasse - Modified from TmfSimpleTimestamp to use nanosecond scale
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.core.timestamp;
+
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
+
+/**
+ * A simplified timestamp where scale is nanoseconds and precision is set to 0.
+ */
+public final class TmfNanoTimestamp extends TmfTimestamp {
+
+    private final long fValue;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Default constructor (value = 0)
+     */
+    public TmfNanoTimestamp() {
+        this(0);
+    }
+
+    /**
+     * Full constructor
+     *
+     * @param value
+     *            the timestamp value
+     */
+    public TmfNanoTimestamp(final long value) {
+        fValue = value;
+    }
+
+    @Override
+    public long getValue() {
+        return fValue;
+    }
+
+
+    @Override
+    public int getScale() {
+        return ITmfTimestamp.NANOSECOND_SCALE;
+    }
+
+    /**
+     * @since 2.0
+     */
+    @Override
+    public long toNanos() {
+        return getValue();
+    }
+}
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/timestamp/TmfSecondTimestamp.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/timestamp/TmfSecondTimestamp.java
new file mode 100644 (file)
index 0000000..88b52b2
--- /dev/null
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Francois Chouinard - Initial API and implementation
+ *   Francois Chouinard - Standardize on the default toString()
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.core.timestamp;
+
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
+
+/**
+ * A simplified timestamp where scale and precision are set to 0.
+ *
+ * @author Francois Chouinard
+ * @since 2.0
+ */
+public class TmfSecondTimestamp extends TmfTimestamp {
+
+    private final long fValue;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Default constructor (value = 0)
+     */
+    public TmfSecondTimestamp() {
+        this(0);
+    }
+
+    /**
+     * Full constructor
+     *
+     * @param value
+     *            the timestamp value
+     */
+    public TmfSecondTimestamp(final long value) {
+        fValue = value;
+    }
+
+    @Override
+    public int getScale() {
+        return ITmfTimestamp.SECOND_SCALE;
+    }
+
+    @Override
+    public long getValue() {
+        return fValue;
+    }
+}
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/timestamp/package-info.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/timestamp/package-info.java
new file mode 100644 (file)
index 0000000..fe339f1
--- /dev/null
@@ -0,0 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+@org.eclipse.jdt.annotation.NonNullByDefault
+package org.eclipse.tracecompass.internal.tmf.core.timestamp;
\ No newline at end of file
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfNanoTimestamp.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfNanoTimestamp.java
deleted file mode 100644 (file)
index 35c6aca..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Francois Chouinard - Initial API and implementation
- *   Patrick Tasse - Modified from TmfSimpleTimestamp to use nanosecond scale
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.core.timestamp;
-
-/**
- * A simplified timestamp where scale is nanoseconds and precision is set to 0.
- */
-public final class TmfNanoTimestamp extends TmfTimestamp {
-
-    private final long fValue;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Default constructor (value = 0)
-     */
-    public TmfNanoTimestamp() {
-        this(0);
-    }
-
-    /**
-     * Full constructor
-     *
-     * @param value
-     *            the timestamp value
-     */
-    public TmfNanoTimestamp(final long value) {
-        fValue = value;
-    }
-
-    @Override
-    public long getValue() {
-        return fValue;
-    }
-
-
-    @Override
-    public int getScale() {
-        return ITmfTimestamp.NANOSECOND_SCALE;
-    }
-
-    /**
-     * @since 2.0
-     */
-    @Override
-    public long toNanos() {
-        return getValue();
-    }
-}
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfSecondTimestamp.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfSecondTimestamp.java
deleted file mode 100644 (file)
index cba8308..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Francois Chouinard - Initial API and implementation
- *   Francois Chouinard - Standardize on the default toString()
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.core.timestamp;
-
-/**
- * A simplified timestamp where scale and precision are set to 0.
- *
- * @author Francois Chouinard
- * @since 2.0
- */
-public class TmfSecondTimestamp extends TmfTimestamp {
-
-    private final long fValue;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Default constructor (value = 0)
-     */
-    public TmfSecondTimestamp() {
-        this(0);
-    }
-
-    /**
-     * Full constructor
-     *
-     * @param value
-     *            the timestamp value
-     */
-    public TmfSecondTimestamp(final long value) {
-        fValue = value;
-    }
-
-    @Override
-    public int getScale() {
-        return ITmfTimestamp.SECOND_SCALE;
-    }
-
-    @Override
-    public long getValue() {
-        return fValue;
-    }
-}
index 141d7a33440f3adcfa074b5bd0c6e45a6cb811cb..0b80e70b9bc0ebbcc88f394a107e6b489e4fa5bb 100644 (file)
@@ -18,6 +18,8 @@ package org.eclipse.tracecompass.tmf.core.timestamp;
 import java.nio.ByteBuffer;
 
 import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.internal.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.internal.tmf.core.timestamp.TmfSecondTimestamp;
 
 /**
  * A generic timestamp implementation. The timestamp is represented by the tuple
This page took 0.031945 seconds and 5 git commands to generate.