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>
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;
/**
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);
}
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;
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;
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,
--- /dev/null
+/*******************************************************************************
+ * 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();
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * 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;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * 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
+++ /dev/null
-/*******************************************************************************
- * 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();
- }
-}
+++ /dev/null
-/*******************************************************************************
- * 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;
- }
-}
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