tmf.core: Introduce TmfTimestamp factory methods
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Sun, 28 Feb 2016 14:59:03 +0000 (09:59 -0500)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Tue, 19 Apr 2016 22:06:49 +0000 (18:06 -0400)
Often times, a TmfTimestamp will be created using a scale of -9 or 0.
The result is a less efficient timestamp that takes more memory than
the nano or simple timestamp and is slower to compare. This patch makes
timestamps created always return the more efficient type.

At the moment, the factory will either create a new TmfNanoTimestamp if the
scale is NANOSECOND_SCALE, TmfSecondTimestamp if the scale is SECOND_SCALE,
or a plain old TmfTimestamp (TmfRealTimestamp).

This patch adds the following helper methods:
* create(value, scale) - create a timestamp with an arbitrary scale and value
* fromNanos(value) - create a nanosecond based timestamp (more efficient)
* fromMicros(value) - create a microsecond based timestamp
* fromMillis(value) - create a millisecond based timestamp
* fromSeconds(value) - create a second based timestamp (more efficient)

Also, TmfTimestamp is converted to an abstract class with "getScale()" and
"getValue()" needing to be implemented. This allows a timestamp like
TmfNanoTimestamp or TmfSecondTimestamp to not store an extra integer and
save 33% of their sizes.

Change-Id: I0996c9b4f626a70436b58e82446ed69d2e50af98
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/65312
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-by: Hudson CI
152 files changed:
analysis/org.eclipse.tracecompass.analysis.graph.core.tests/src/org/eclipse/tracecompass/analysis/graph/core/tests/graph/TmfGraphTest.java
analysis/org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests/src/org/eclipse/tracecompass/analysis/os/linux/ui/swtbot/tests/latency/SystemCallLatencyDensityViewTest.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/density/ZoomOutAction.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/scatter/SegmentStoreScatterGraphTooltipProvider.java
btf/org.eclipse.tracecompass.btf.core.tests/src/org/eclipse/tracecompass/btf/core/tests/trace/BtfTraceTest.java
btf/org.eclipse.tracecompass.btf.core/src/org/eclipse/tracecompass/btf/core/trace/BtfTimestampFormat.java
ctf/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceGrowingStreamTest.java
ctf/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/ArrayDefinition2Test.java
ctf/org.eclipse.tracecompass.ctf.parser/target/generated-sources/antlr3/org/eclipse/tracecompass/ctf/parser/CTFLexer.java
ctf/org.eclipse.tracecompass.ctf.parser/target/generated-sources/antlr3/org/eclipse/tracecompass/ctf/parser/CTFParser.java
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/context/CtfLocationTest.java
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/event/CtfTmfLostEventsTest.java
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/event/EventContextTest.java
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/temp/request/TmfSchedulerTest.java
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/temp/tracemanager/TmfTraceManagerTest.java
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/trace/CtfTmfTraceTest.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/event/CtfTmfEvent.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/event/CtfTmfEventFactory.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/event/CtfTmfLostEvent.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/trace/CtfTmfTrace.java
doc/org.eclipse.tracecompass.doc.dev/doc/Developer-Guide.mediawiki
gdbtrace/org.eclipse.tracecompass.gdbtrace.core/src/org/eclipse/tracecompass/internal/gdbtrace/core/trace/DsfGdbAdaptor.java
gdbtrace/org.eclipse.tracecompass.gdbtrace.ui/src/org/eclipse/tracecompass/internal/gdbtrace/ui/views/events/GdbEventsTable.java
lttng/org.eclipse.tracecompass.lttng2.common.core.tests/src/org/eclipse/tracecompass/lttng2/common/core/tests/ActivatorTest.java
lttng/org.eclipse.tracecompass.lttng2.control.core.tests/src/org/eclipse/tracecompass/lttng2/control/core/tests/model/impl/BaseEventInfoTest.java
lttng/org.eclipse.tracecompass.lttng2.control.core.tests/src/org/eclipse/tracecompass/lttng2/control/core/tests/model/impl/ChannelInfoTest.java
lttng/org.eclipse.tracecompass.lttng2.control.core.tests/src/org/eclipse/tracecompass/lttng2/control/core/tests/model/impl/DomainInfoTest.java
lttng/org.eclipse.tracecompass.lttng2.control.core.tests/src/org/eclipse/tracecompass/lttng2/control/core/tests/model/impl/FieldInfoTest.java
lttng/org.eclipse.tracecompass.lttng2.control.core.tests/src/org/eclipse/tracecompass/lttng2/control/core/tests/model/impl/ProbeEventInfoTest.java
lttng/org.eclipse.tracecompass.lttng2.control.core.tests/src/org/eclipse/tracecompass/lttng2/control/core/tests/model/impl/SessionInfoTest.java
lttng/org.eclipse.tracecompass.lttng2.control.core.tests/src/org/eclipse/tracecompass/lttng2/control/core/tests/model/impl/UstProviderInfoTest.java
lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/relayd/LttngRelaydConsumer.java
lttng/org.eclipse.tracecompass.lttng2.kernel.core.tests/src/org/eclipse/tracecompass/lttng2/kernel/core/tests/ActivatorTest.java
lttng/org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/kernel/ui/swtbot/tests/ControlFlowViewSortingTest.java
lttng/org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/kernel/ui/swtbot/tests/ControlFlowViewTest.java
lttng/org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/kernel/ui/swtbot/tests/ResourcesViewTest.java
lttng/org.eclipse.tracecompass.lttng2.ust.core.tests/src/org/eclipse/tracecompass/lttng2/ust/core/tests/ActivatorTest.java
lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/trace/LttngUstEvent.java
lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/trace/LttngUstEventFactory.java
lttng/org.eclipse.tracecompass.lttng2.ust.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/ust/ui/swtbot/tests/CallStackViewTest.java
pcap/org.eclipse.tracecompass.tmf.pcap.core.tests/src/org/eclipse/tracecompass/tmf/pcap/core/tests/event/PcapEventTest.java
pcap/org.eclipse.tracecompass.tmf.pcap.core/src/org/eclipse/tracecompass/internal/tmf/pcap/core/event/TmfPacketStream.java
pcap/org.eclipse.tracecompass.tmf.pcap.core/src/org/eclipse/tracecompass/internal/tmf/pcap/core/util/PcapEventFactory.java
tmf/org.eclipse.tracecompass.tmf.analysis.xml.core.tests/stubs/org/eclipse/tracecompass/tmf/analysis/xml/core/tests/stubs/PatternSegmentFactoryStub.java
tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/tmf/analysis/xml/core/segment/TmfXmlPatternSegment.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/analysis/requirements/AnalysisRequirementHelperTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/analysis/requirements/AnalysisRequirementTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/component/TmfEventProviderTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/event/TmfEventTest.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 [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/event/TmfSimpleTimestampTest.java [deleted file]
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/event/TmfTimeRangeTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/event/TmfTimestampDeltaTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/event/TmfTimestampTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/filter/TmfCollapseFilterTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/filter/TmfFilterAndNodeTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/filter/TmfFilterCompareNodeTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/filter/TmfFilterContainsNodeTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/filter/TmfFilterEqualsNodeTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/filter/TmfFilterMatchesNodeTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/filter/TmfFilterNodeTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/filter/TmfFilterOrNodeTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/filter/TmfFilterRootNodeTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/filter/TmfFilterTraceTypeNodeTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/request/TmfCoalescedEventRequestTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/request/TmfEventRequestTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/statesystem/mipmap/TmfMipmapStateProviderStub.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/statesystem/mipmap/TmfMipmapStateProviderWeightedTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/synchronization/SyncTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/synchronization/TsTransformFactoryTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/synchronization/TsTransformTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/TmfContextTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/TmfExperimentTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/TmfTraceTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/indexer/AbstractCheckpointCollectionTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/indexer/AllBench.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/indexer/BTreeTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/indexer/FlatArrayTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/indexer/TmfMemoryIndexTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest2.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/indexer/checkpoint/TmfExperimentCheckpointIndexTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/location/TmfLocationTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/text/TextTraceTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/uml2sd/TmfAsyncSequenceDiagramEventTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/uml2sd/TmfSyncSequenceDiagramEventTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/stubs/org/eclipse/tracecompass/tmf/tests/stubs/component/TmfSyntheticEventProviderStub.java
tmf/org.eclipse.tracecompass.tmf.core.tests/stubs/org/eclipse/tracecompass/tmf/tests/stubs/trace/TmfTraceStub.java
tmf/org.eclipse.tracecompass.tmf.core.tests/stubs/org/eclipse/tracecompass/tmf/tests/stubs/trace/text/SyslogTrace.java
tmf/org.eclipse.tracecompass.tmf.core.tests/stubs/org/eclipse/tracecompass/tmf/tests/stubs/trace/xml/TmfXmlTraceStub.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/statesystem/backends/partial/PartialHistoryBackend.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/statesystem/mipmap/AvgMipmapFeature.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/synchronization/TmfConstantTransform.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/synchronization/TmfTimestampTransformLinear.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/synchronization/TmfTimestampTransformLinearFast.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/trace/indexer/AbstractFileCheckpointCollection.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/trace/indexer/BTreeNode.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/trace/indexer/FlatArray.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/filter/model/TmfFilterCompareNode.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomEvent.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statistics/TmfEventsStatistics.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfNanoTimestamp.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfRealTimestamp.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfSecondTimestamp.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfSimpleTimestamp.java [deleted file]
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfTimestamp.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfTimestampDelta.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/TmfTrace.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/TmfTraceManager.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/indexer/checkpoint/TmfCheckpoint.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/location/TmfTimestampLocation.java
tmf/org.eclipse.tracecompass.tmf.remote.core.tests/src/org/eclipse/tracecompass/tmf/remote/core/tests/shell/CommandShellTest.java
tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/histogram/HistogramDataModelTest.java
tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java
tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java
tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java
tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/statistics/TmfTreeContentProviderTest.java
tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/views/uml2sd/loader/IUml2SdSignalValidator.java
tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderSignalTest.java
tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/views/uml2sd/loader/TmfUml2SDSyncLoaderTimeTest.java
tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/views/uml2sd/loader/Uml2SDSignalValidator.java
tmf/org.eclipse.tracecompass.tmf.ui.tests/src/org/eclipse/tracecompass/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestTimestamp.java
tmf/org.eclipse.tracecompass.tmf.ui.tests/widgetStubs/org/eclipse/tracecompass/tmf/ui/tests/uml2sd/load/TestLoaders.java
tmf/org.eclipse.tracecompass.tmf.ui.tests/widgetStubs/org/eclipse/tracecompass/tmf/ui/tests/uml2sd/trace/TmfUml2SDTestTrace.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/markers/LostEventsMarkerEventSourceFactory.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/wizards/CustomXmlParserInputWizardPage.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/dialogs/offset/OffsetDialog.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/views/TmfAlignmentSynchronizer.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/TmfTimeViewer.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/events/TmfEventsTable.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractTmfTreeViewer.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xycharts/TmfClosestDataPointTooltipProvider.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xycharts/TmfSimpleTooltipProvider.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xycharts/barcharts/TmfHistogramTooltipProvider.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xycharts/linecharts/TmfCommonXLineChartTooltipProvider.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/Histogram.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/HistogramCurrentTimeControl.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/HistogramTimeRangeControl.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/HistogramView.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/statesystem/TmfStateSystemViewer.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timechart/TimeChartView.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/TimeCompressionBar.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/core/AsyncMessage.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/core/BasicFrame.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/core/SyncMessage.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/dialogs/MinMaxDialog.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java

index 8d7c0e62f5062a714a3a5b103c0cb6341fdb1024..d064026bb7fadc33741f2b879fc986d35479d308 100644 (file)
@@ -284,14 +284,14 @@ public class TmfGraphTest {
             vertices[i] = v;
             fGraph.append(WORKER1, v);
         }
-        assertEquals(vertices[0], fGraph.getVertexAt(new TmfTimestamp(5), WORKER1));
-        assertEquals(vertices[0], fGraph.getVertexAt(new TmfTimestamp(0), WORKER1));
-        assertEquals(vertices[1], fGraph.getVertexAt(new TmfTimestamp(6), WORKER1));
-        assertEquals(vertices[3], fGraph.getVertexAt(new TmfTimestamp(19), WORKER1));
-        assertNull(fGraph.getVertexAt(new TmfTimestamp(19), WORKER2));
-        assertEquals(vertices[3], fGraph.getVertexAt(new TmfTimestamp(20), WORKER1));
-        assertEquals(vertices[4], fGraph.getVertexAt(new TmfTimestamp(21), WORKER1));
-        assertNull(fGraph.getVertexAt(new TmfTimestamp(26), WORKER1));
+        assertEquals(vertices[0], fGraph.getVertexAt(TmfTimestamp.fromSeconds(5), WORKER1));
+        assertEquals(vertices[0], fGraph.getVertexAt(TmfTimestamp.fromSeconds(0), WORKER1));
+        assertEquals(vertices[1], fGraph.getVertexAt(TmfTimestamp.fromSeconds(6), WORKER1));
+        assertEquals(vertices[3], fGraph.getVertexAt(TmfTimestamp.fromSeconds(19), WORKER1));
+        assertNull(fGraph.getVertexAt(TmfTimestamp.fromSeconds(19), WORKER2));
+        assertEquals(vertices[3], fGraph.getVertexAt(TmfTimestamp.fromSeconds(20), WORKER1));
+        assertEquals(vertices[4], fGraph.getVertexAt(TmfTimestamp.fromSeconds(21), WORKER1));
+        assertNull(fGraph.getVertexAt(TmfTimestamp.fromSeconds(26), WORKER1));
     }
 
     /**
index 1a825a406d8f74f31b0e417f31fefb4008095ba2..eeccab6635370c02b3dddc5309b95680e0c4f0cc 100644 (file)
 package org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests.latency;
 
 import static org.eclipse.swtbot.swt.finder.SWTBotAssert.assertVisible;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.IOException;
 import java.lang.reflect.Field;
index 9f5c01d45bb9d5ac69430616396b9fc30122d89e..43f6e2594f478de2a509dd276ac5ad19de063d33 100644 (file)
@@ -13,8 +13,8 @@ import org.eclipse.jface.action.Action;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.AnalysisTimingImageConstants;
 import org.eclipse.tracecompass.common.core.NonNullUtils;
-import org.swtchart.Range;
 import org.eclipse.tracecompass.internal.analysis.timing.ui.Activator;
+import org.swtchart.Range;
 
 /**
  * Zoom action for the density view
index 60fb8fb22c28131b4a472d43cbc1752d1e750656..43693b5a6a3d69d7fd96ab930037b83323a3617f 100644 (file)
@@ -45,7 +45,7 @@ import org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal;
 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.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampFormat;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
@@ -104,8 +104,8 @@ public abstract class AbstractSegmentStoreTableViewer extends TmfSimpleTableView
         @Override
         public void widgetSelected(@Nullable SelectionEvent e) {
             ISegment selectedSegment = ((ISegment) NonNullUtils.checkNotNull(e).item.getData());
-            ITmfTimestamp start = new TmfNanoTimestamp(selectedSegment.getStart());
-            ITmfTimestamp end = new TmfNanoTimestamp(selectedSegment.getEnd());
+            ITmfTimestamp start = TmfTimestamp.fromNanos(selectedSegment.getStart());
+            ITmfTimestamp end = TmfTimestamp.fromNanos(selectedSegment.getEnd());
             TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreTableViewer.this, start, end));
         }
     }
@@ -279,14 +279,14 @@ public abstract class AbstractSegmentStoreTableViewer extends TmfSimpleTableView
             IAction gotoStartTime = new Action(Messages.SegmentStoreTableViewer_goToStartEvent) {
                 @Override
                 public void run() {
-                    broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreTableViewer.this, new TmfNanoTimestamp(segment.getStart())));
+                    broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreTableViewer.this, TmfTimestamp.fromNanos(segment.getStart())));
                 }
             };
 
             IAction gotoEndTime = new Action(Messages.SegmentStoreTableViewer_goToEndEvent) {
                 @Override
                 public void run() {
-                    broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreTableViewer.this, new TmfNanoTimestamp(segment.getEnd())));
+                    broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreTableViewer.this, TmfTimestamp.fromNanos(segment.getEnd())));
                 }
             };
 
index 50d22ce38c90602bd53ea78c37564a1f12b3c554..395b11847f61ad824a9e6f69edbbf436fc11b8ec 100644 (file)
@@ -14,7 +14,6 @@ package org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.
 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
 
 import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.ITmfChartTimeProvider;
 import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.TmfClosestDataPointTooltipProvider;
@@ -57,7 +56,7 @@ public class SegmentStoreScatterGraphTooltipProvider extends TmfClosestDataPoint
             if ((xS != null) && (yS != null) && (dataIndex < xS.length) && (dataIndex < yS.length)) {
                 StringBuffer buffer = new StringBuffer();
                 buffer.append(checkNotNull(Messages.SegmentStoreScatterGraphViewer_xAxis)).append('=');
-                buffer.append(new TmfTimestamp((long) xS[dataIndex] + getChartViewer().getTimeOffset(), ITmfTimestamp.NANOSECOND_SCALE).toString());
+                buffer.append(TmfTimestamp.fromNanos((long) xS[dataIndex] + getChartViewer().getTimeOffset()).toString());
                 buffer.append('\n');
                 buffer.append(Messages.SegmentStoreScatterGraphViewer_yAxis).append('=');
                 buffer.append((long) yS[dataIndex]);
index f7afd0084f63abb9224f447d23eba6c8e3b3a091..a5adae9449434ce8b6f074d7b802fd669dc779cb 100644 (file)
@@ -11,7 +11,9 @@
  *******************************************************************************/
 package org.eclipse.tracecompass.btf.core.tests.trace;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.util.Map;
 
index 8953f62be0f9a158994dee088326859323ec8135..f02819a0a25ff363631e12669cdca875da5edef0 100644 (file)
@@ -100,6 +100,6 @@ public enum BtfTimestampFormat {
      * @return TmfTimestamp with proper scale
      */
     public @NonNull ITmfTimestamp createTimestamp(long timestamp) {
-        return new TmfTimestamp(timestamp, fScale);
+        return TmfTimestamp.create(timestamp, fScale);
     }
 }
index f7342b54e56559cbc80e7ed60e195f2a64e2689f..86f73d8db8aadcf2963c01e31d87d7a29fb2acb4 100644 (file)
@@ -11,7 +11,9 @@
 
 package org.eclipse.tracecompass.ctf.core.tests.trace;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 
 import java.io.File;
 import java.io.FileNotFoundException;
index df04f5c28279eb2cb89c39f1bd97a79ce7df0cd9..8f632a57817cafb27fe910d6668767f9928bcfcf 100644 (file)
@@ -11,7 +11,7 @@
 
 package org.eclipse.tracecompass.ctf.core.tests.types;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
 
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
index 0ac655c64a223c400a6f7fc1badb3b641953af6f..47246c2b6b2ec83af9e4b63d39493a2bb815f484 100644 (file)
 package org.eclipse.tracecompass.ctf.parser;
 
 
-import org.antlr.runtime.*;
-import java.util.Stack;
-import java.util.List;
-import java.util.ArrayList;
+import org.antlr.runtime.BaseRecognizer;
+import org.antlr.runtime.CharStream;
+import org.antlr.runtime.DFA;
+import org.antlr.runtime.EarlyExitException;
+import org.antlr.runtime.Lexer;
+import org.antlr.runtime.MismatchedSetException;
+import org.antlr.runtime.NoViableAltException;
+import org.antlr.runtime.RecognitionException;
+import org.antlr.runtime.RecognizerSharedState;
 
 @SuppressWarnings("all")
 public class CTFLexer extends Lexer {
index bf256e09230e0d8e19b696482bc6e38f1ab8742f..70c4e1dae7a3b7c86feda96060c40002c87365bb 100644 (file)
 
 package org.eclipse.tracecompass.ctf.parser;
 
-import java.util.Set;
 import java.util.HashSet;
-
-
-import org.antlr.runtime.*;
+import java.util.Set;
 import java.util.Stack;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
 
-import org.antlr.runtime.tree.*;
+import org.antlr.runtime.BaseRecognizer;
+import org.antlr.runtime.BitSet;
+import org.antlr.runtime.DFA;
+import org.antlr.runtime.EarlyExitException;
+import org.antlr.runtime.FailedPredicateException;
+import org.antlr.runtime.IntStream;
+import org.antlr.runtime.MismatchedSetException;
+import org.antlr.runtime.MismatchedTokenException;
+import org.antlr.runtime.NoViableAltException;
+import org.antlr.runtime.Parser;
+import org.antlr.runtime.ParserRuleReturnScope;
+import org.antlr.runtime.RecognitionException;
+import org.antlr.runtime.RecognizerSharedState;
+import org.antlr.runtime.Token;
+import org.antlr.runtime.TokenStream;
+import org.antlr.runtime.tree.CommonTree;
+import org.antlr.runtime.tree.CommonTreeAdaptor;
+import org.antlr.runtime.tree.RewriteEarlyExitException;
+import org.antlr.runtime.tree.RewriteRuleSubtreeStream;
+import org.antlr.runtime.tree.RewriteRuleTokenStream;
+import org.antlr.runtime.tree.TreeAdaptor;
 
 
 @SuppressWarnings("all")
index fd7067495f1dcfcbd4a7e3c25fd0d56a85fb5606..b62517d7cf50004f747f59d5cecedaf83041e67e 100644 (file)
@@ -59,7 +59,7 @@ public class CtfLocationTest {
      */
     @Test
     public void testCtfLocation_timestamp() {
-        ITmfTimestamp timestamp = new TmfTimestamp();
+        ITmfTimestamp timestamp = TmfTimestamp.fromSeconds(0);
         CtfLocation result = new CtfLocation(timestamp);
 
         assertNotNull(result);
index 81c1d6769575b128955ee4b800d6db6b5a8aaf5e..48e01931554f27f02a5472ddfa9a32f0784dedf2 100644 (file)
@@ -24,8 +24,8 @@ import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
 import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
 import org.eclipse.tracecompass.tmf.core.synchronization.TimestampTransformFactory;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
 import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTraceUtils;
@@ -131,8 +131,8 @@ public class CtfTmfLostEventsTest {
     public void testFirstLostEvent() {
         final long rank = 190;
         final long startTime = 1376592664828900165L;
-        final ITmfTimestamp start = new TmfNanoTimestamp(startTime);
-        final ITmfTimestamp end = new TmfNanoTimestamp(startTime + 502911L);
+        final ITmfTimestamp start = TmfTimestamp.fromNanos(startTime);
+        final ITmfTimestamp end = TmfTimestamp.fromNanos(startTime + 502911L);
         final long nbLost = 859;
 
         validateLostEvent(rank, start, end, nbLost);
@@ -145,8 +145,8 @@ public class CtfTmfLostEventsTest {
     public void testSecondLostEvent() {
         final long rank = 229;
         final long startTime = 1376592664829477058L;
-        final ITmfTimestamp start = new TmfNanoTimestamp(startTime);
-        final ITmfTimestamp end = new TmfNanoTimestamp(startTime + 347456L);
+        final ITmfTimestamp start = TmfTimestamp.fromNanos(startTime);
+        final ITmfTimestamp end = TmfTimestamp.fromNanos(startTime + 347456L);
         final long nbLost = 488;
 
         validateLostEvent(rank, start, end, nbLost);
@@ -174,7 +174,7 @@ public class CtfTmfLostEventsTest {
     @Test
     public void testNormalEvent() {
         final long rank = 200;
-        final ITmfTimestamp ts = new TmfNanoTimestamp(1376592664829425780L);
+        final ITmfTimestamp ts = TmfTimestamp.fromNanos(1376592664829425780L);
 
         final CtfTmfEvent event = getOneEventTime(ts);
         /* Make sure seeking by rank yields the same event */
@@ -196,8 +196,8 @@ public class CtfTmfLostEventsTest {
         trace.indexTrace(true);
 
         final long rank = 190;
-        final ITmfTimestamp start = new TmfNanoTimestamp(1376592664828900165L + offset);
-        final ITmfTimestamp end = new TmfNanoTimestamp(1376592664828900165L + 502911L + offset);
+        final ITmfTimestamp start = TmfTimestamp.fromNanos(1376592664828900165L + offset);
+        final ITmfTimestamp end = TmfTimestamp.fromNanos(1376592664828900165L + 502911L + offset);
         final long nbLost = 859;
 
         ITmfContext context = trace.seekEvent(rank);
index 1e49e5230cede9eec5a71f3f536b5922e006895c..6c92b2037b533c862e6a9b1e7c1c80aebca64fe4 100644 (file)
@@ -18,7 +18,6 @@ import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
 import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
@@ -218,7 +217,7 @@ public class EventContextTest {
 
         public EventContextTestRequest(long timestamp) {
             super(CtfTmfEvent.class,
-                    new TmfTimeRange(new TmfNanoTimestamp(timestamp), TmfTimestamp.BIG_CRUNCH),
+                    new TmfTimeRange(TmfTimestamp.fromNanos(timestamp), TmfTimestamp.BIG_CRUNCH),
                     0, 1, ExecutionType.FOREGROUND);
         }
 
index d9966bf09fa8a6d6df142e0595376756dd377fcd..30098925ef1d8a316a5c000c342837e530b549b5 100644 (file)
@@ -28,7 +28,6 @@ import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
 import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
 import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTraceUtils;
@@ -48,7 +47,7 @@ public class TmfSchedulerTest {
 
     /** Time-out tests after 60 seconds */
     @Rule
-    public TestRule globalTimeout= new Timeout(1, TimeUnit.MINUTES);
+    public TestRule globalTimeout = new Timeout(1, TimeUnit.MINUTES);
 
     // ------------------------------------------------------------------------
     // Constants
@@ -84,8 +83,8 @@ public class TmfSchedulerTest {
 
         long foregroundStartTime = fStartTime + ((fEndTime - fStartTime) / 4);
         long foregroundEndTime = fStartTime + ((fEndTime - fStartTime) / 2);
-        fForegroundTimeRange = new TmfTimeRange(new TmfTimestamp(foregroundStartTime, ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(foregroundEndTime, ITmfTimestamp.NANOSECOND_SCALE));
+        fForegroundTimeRange = new TmfTimeRange(TmfTimestamp.fromNanos(foregroundStartTime),
+                TmfTimestamp.fromNanos(foregroundEndTime));
     }
 
     /**
@@ -185,7 +184,7 @@ public class TmfSchedulerTest {
         ForegroundRequest foreground3 = new ForegroundRequest(TmfTimeRange.ETERNITY);
         fixture.sendRequest(foreground3);
 
-        TmfSelectionRangeUpdatedSignal signal3 = new TmfSelectionRangeUpdatedSignal(this, new TmfTimestamp(fForegroundTimeRange.getStartTime()));
+        TmfSelectionRangeUpdatedSignal signal3 = new TmfSelectionRangeUpdatedSignal(this, fForegroundTimeRange.getStartTime());
         fixture.broadcast(signal3);
 
         try {
@@ -205,7 +204,7 @@ public class TmfSchedulerTest {
     public void TestMultiRequest4() {
         ForegroundRequest foreground4 = new ForegroundRequest(fForegroundTimeRange);
         fixture.sendRequest(foreground4);
-        TmfSelectionRangeUpdatedSignal signal4 = new TmfSelectionRangeUpdatedSignal(this, new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 8)));
+        TmfSelectionRangeUpdatedSignal signal4 = new TmfSelectionRangeUpdatedSignal(this, TmfTimestamp.fromSeconds(fStartTime + ((fEndTime - fStartTime) / 8)));
         fixture.broadcast(signal4);
 
         try {
@@ -225,7 +224,7 @@ public class TmfSchedulerTest {
     public void TestMultiRequest5() {
         ForegroundRequest foreground5 = new ForegroundRequest(fForegroundTimeRange);
         fixture.sendRequest(foreground5);
-        TmfSelectionRangeUpdatedSignal signal5 = new TmfSelectionRangeUpdatedSignal(this, new TmfTimestamp(fEndTime - ((fEndTime - fStartTime) / 4)));
+        TmfSelectionRangeUpdatedSignal signal5 = new TmfSelectionRangeUpdatedSignal(this, TmfTimestamp.fromSeconds(fEndTime - ((fEndTime - fStartTime) / 4)));
         fixture.broadcast(signal5);
 
         try {
@@ -249,7 +248,7 @@ public class TmfSchedulerTest {
         fixture.sendRequest(background6);
         fixture.sendRequest(foreground6);
 
-        TmfSelectionRangeUpdatedSignal signal6 = new TmfSelectionRangeUpdatedSignal(this, new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 8)));
+        TmfSelectionRangeUpdatedSignal signal6 = new TmfSelectionRangeUpdatedSignal(this, TmfTimestamp.fromSeconds(fStartTime + ((fEndTime - fStartTime) / 8)));
         fixture.broadcast(signal6);
 
         try {
@@ -297,8 +296,8 @@ public class TmfSchedulerTest {
     @Test
     public void preemptedForegroundRequest() {
         ForegroundRequest foreground9 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-        TmfTimeRange shortTimeRange = new TmfTimeRange(new TmfTimestamp(fStartTime, ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 16), ITmfTimestamp.NANOSECOND_SCALE));
+        TmfTimeRange shortTimeRange = new TmfTimeRange(TmfTimestamp.fromNanos(fStartTime),
+                TmfTimestamp.fromNanos(fStartTime + ((fEndTime - fStartTime) / 16)));
         ForegroundRequest shortForeground = new ForegroundRequest(shortTimeRange);
         fixture.sendRequest(foreground9);
         try {
index 5c552b688f7b7221a375b07f546540160d8c6d0c..7c7721916e2ca917276de053baa6aca1b730034e 100644 (file)
@@ -61,8 +61,6 @@ public class TmfTraceManagerTest {
     @Rule
     public TestRule globalTimeout = new Timeout(1, TimeUnit.MINUTES);
 
-    private static final int SCALE = ITmfTimestamp.NANOSECOND_SCALE;
-
     private static ITmfTrace trace1;
     private static final long t1start = 1331668247314038062L;
     private static final long t1end = 1331668259054285979L;
@@ -275,7 +273,7 @@ public class TmfTraceManagerTest {
     @Test
     public void testNewTimestamp() {
         openTrace(trace2);
-        ITmfTimestamp ts = new TmfTimestamp(t2start + ONE_SECOND, SCALE);
+        ITmfTimestamp ts = TmfTimestamp.fromNanos(t2start + ONE_SECOND);
         selectTimestamp(ts);
 
         TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
@@ -291,7 +289,7 @@ public class TmfTraceManagerTest {
     public void testTimestampBefore() {
         openTrace(trace2);
         TmfTimeRange beforeTr = tm.getCurrentTraceContext().getSelectionRange();
-        ITmfTimestamp ts = new TmfTimestamp(t2start - ONE_SECOND, SCALE);
+        ITmfTimestamp ts = TmfTimestamp.fromNanos(t2start - ONE_SECOND);
         selectTimestamp(ts);
 
         TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
@@ -306,7 +304,7 @@ public class TmfTraceManagerTest {
     public void testTimestampAfter() {
         openTrace(trace2);
         TmfTimeRange beforeTr = tm.getCurrentTraceContext().getSelectionRange();
-        ITmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
+        ITmfTimestamp ts = TmfTimestamp.fromNanos(t2end + ONE_SECOND);
         selectTimestamp(ts);
 
         TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
@@ -320,8 +318,8 @@ public class TmfTraceManagerTest {
     public void testTraceNewTimeRange() {
         openTrace(trace2);
         TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t2start + ONE_SECOND, SCALE),
-                new TmfTimestamp(t2end - ONE_SECOND, SCALE));
+                TmfTimestamp.fromNanos(t2start + ONE_SECOND),
+                TmfTimestamp.fromNanos(t2end - ONE_SECOND));
         selectWindowRange(range);
 
         TmfTimeRange curRange = tm.getCurrentTraceContext().getWindowRange();
@@ -336,8 +334,8 @@ public class TmfTraceManagerTest {
     public void testTraceTimeRangeClampingStart() {
         openTrace(trace2);
         TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t2start - ONE_SECOND, SCALE), // minus here
-                new TmfTimestamp(t2end - ONE_SECOND, SCALE));
+                TmfTimestamp.fromNanos(t2start - ONE_SECOND), // minus here
+                TmfTimestamp.fromNanos(t2end - ONE_SECOND));
         selectWindowRange(range);
 
         TmfTimeRange curRange = tm.getCurrentTraceContext().getWindowRange();
@@ -353,8 +351,8 @@ public class TmfTraceManagerTest {
     public void testTraceTimeRangeClampingEnd() {
         openTrace(trace2);
         TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t2start + ONE_SECOND, SCALE),
-                new TmfTimestamp(t2end + ONE_SECOND, SCALE)); // plus here
+                TmfTimestamp.fromNanos(t2start + ONE_SECOND),
+                TmfTimestamp.fromNanos(t2end + ONE_SECOND)); // plus here
         selectWindowRange(range);
 
         TmfTimeRange curRange = tm.getCurrentTraceContext().getWindowRange();
@@ -371,8 +369,8 @@ public class TmfTraceManagerTest {
     public void testTraceTimeRangeClampingBoth() {
         openTrace(trace2);
         TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t2start - ONE_SECOND, SCALE), // minus here
-                new TmfTimestamp(t2end + ONE_SECOND, SCALE)); // plus here
+                TmfTimestamp.fromNanos(t2start - ONE_SECOND), // minus here
+                TmfTimestamp.fromNanos(t2end + ONE_SECOND)); // plus here
         selectWindowRange(range);
 
         TmfTimeRange curRange = tm.getCurrentTraceContext().getWindowRange();
@@ -396,7 +394,7 @@ public class TmfTraceManagerTest {
         openTrace(trace1);
         openTrace(trace2);
         selectTrace(trace1);
-        TmfTimestamp ts = new TmfTimestamp(t1start + ONE_SECOND, SCALE);
+        ITmfTimestamp ts = TmfTimestamp.fromNanos(t1start + ONE_SECOND);
         selectTimestamp(ts);
 
         /* Timestamp of trace1 should have been updated */
@@ -423,7 +421,7 @@ public class TmfTraceManagerTest {
         openTrace(trace1);
         openTrace(trace2);
         selectTrace(trace1);
-        TmfTimestamp ts = new TmfTimestamp(t1end + ONE_SECOND, SCALE);
+        ITmfTimestamp ts = TmfTimestamp.fromNanos(t1end + ONE_SECOND);
         selectTimestamp(ts);
 
         /* Timestamp of trace1 should not have changed */
@@ -449,7 +447,7 @@ public class TmfTraceManagerTest {
         openTrace(trace1);
         openTrace(trace2);
         selectTrace(trace1);
-        TmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
+        ITmfTimestamp ts = TmfTimestamp.fromNanos(t2end + ONE_SECOND);
         selectTimestamp(ts);
 
         /* Timestamp of trace1 should not have changed */
@@ -475,8 +473,8 @@ public class TmfTraceManagerTest {
         openTrace(trace2);
         selectTrace(trace1);
         TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t1start + ONE_SECOND, SCALE),
-                new TmfTimestamp(t1end - ONE_SECOND, SCALE));
+                TmfTimestamp.fromNanos(t1start + ONE_SECOND),
+                TmfTimestamp.fromNanos(t1end - ONE_SECOND));
         selectWindowRange(range);
 
         /* Range of trace1 should be equal to the requested one */
@@ -500,14 +498,14 @@ public class TmfTraceManagerTest {
         openTrace(trace2);
         selectTrace(trace1);
         TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t1start + ONE_SECOND, SCALE),
-                new TmfTimestamp(t1end + ONE_SECOND, SCALE));
+                TmfTimestamp.fromNanos(t1start + ONE_SECOND),
+                TmfTimestamp.fromNanos(t1end + ONE_SECOND));
         selectWindowRange(range);
 
         /* Range of trace1 should get clamped to its end time */
         TmfTimeRange expectedRange = new TmfTimeRange(
-                new TmfTimestamp(t1start + ONE_SECOND, SCALE),
-                new TmfTimestamp(t1end, SCALE));
+                TmfTimestamp.fromNanos(t1start + ONE_SECOND),
+                TmfTimestamp.fromNanos(t1end));
         assertEquals(expectedRange, tm.getCurrentTraceContext().getWindowRange());
 
         /* Range of trace2 should not have changed */
@@ -527,21 +525,21 @@ public class TmfTraceManagerTest {
         openTrace(trace2);
         selectTrace(trace1);
         TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t1end - ONE_SECOND, SCALE),
-                new TmfTimestamp(t2start + ONE_SECOND, SCALE));
+                TmfTimestamp.fromNanos(t1end - ONE_SECOND),
+                TmfTimestamp.fromNanos(t2start + ONE_SECOND));
         selectWindowRange(range);
 
         /* Range of trace1 should be clamped to its end time */
         TmfTimeRange expectedRange = new TmfTimeRange(
-                new TmfTimestamp(t1end - ONE_SECOND, SCALE),
-                new TmfTimestamp(t1end, SCALE));
+                TmfTimestamp.fromNanos(t1end - ONE_SECOND),
+                TmfTimestamp.fromNanos(t1end));
         assertEquals(expectedRange, tm.getCurrentTraceContext().getWindowRange());
 
         /* Range of trace2 should be clamped to its start time */
         selectTrace(trace2);
         expectedRange = new TmfTimeRange(
-                new TmfTimestamp(t2start, SCALE),
-                new TmfTimestamp(t2start + ONE_SECOND, SCALE));
+                TmfTimestamp.fromNanos(t2start),
+                TmfTimestamp.fromNanos(t2start + ONE_SECOND));
         assertEquals(expectedRange, tm.getCurrentTraceContext().getWindowRange());
     }
 
@@ -557,8 +555,8 @@ public class TmfTraceManagerTest {
         openTrace(trace2);
         selectTrace(trace1);
         TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t1end + ONE_SECOND, SCALE),
-                new TmfTimestamp(t1end - ONE_SECOND, SCALE));
+                TmfTimestamp.fromNanos(t1end + ONE_SECOND),
+                TmfTimestamp.fromNanos(t1end - ONE_SECOND));
         selectWindowRange(range);
 
         /* Range of trace1 should not have changed */
@@ -589,7 +587,7 @@ public class TmfTraceManagerTest {
     public void testExperimentTimestampInTrace() {
         TmfExperiment exp = createExperiment(trace1, trace2);
         openTrace(exp);
-        TmfTimestamp ts = new TmfTimestamp(t1start + ONE_SECOND, SCALE);
+        ITmfTimestamp ts = TmfTimestamp.fromNanos(t1start + ONE_SECOND);
         selectTimestamp(ts);
 
         /* The experiment's current time should be updated. */
@@ -609,7 +607,7 @@ public class TmfTraceManagerTest {
     public void testExperimentTimestampInBetween() {
         TmfExperiment exp = createExperiment(trace1, trace2);
         openTrace(exp);
-        TmfTimestamp ts = new TmfTimestamp(t1end + ONE_SECOND, SCALE);
+        ITmfTimestamp ts = TmfTimestamp.fromNanos(t1end + ONE_SECOND);
         selectTimestamp(ts);
 
         /* The experiment's current time should be updated. */
@@ -628,7 +626,7 @@ public class TmfTraceManagerTest {
     public void testExperimentTimestampInvalid() {
         TmfExperiment exp = createExperiment(trace1, trace2);
         openTrace(exp);
-        TmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
+        ITmfTimestamp ts = TmfTimestamp.fromNanos(t2end + ONE_SECOND);
         selectTimestamp(ts);
 
         /* The experiment's current time should NOT be updated. */
@@ -664,8 +662,8 @@ public class TmfTraceManagerTest {
         openTrace(exp);
 
         final TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t1start - ONE_SECOND, SCALE),
-                new TmfTimestamp(t1end - ONE_SECOND, SCALE));
+                TmfTimestamp.fromNanos(t1start - ONE_SECOND),
+                TmfTimestamp.fromNanos(t1end - ONE_SECOND));
         selectWindowRange(range);
 
         TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
@@ -684,8 +682,8 @@ public class TmfTraceManagerTest {
         openTrace(exp);
 
         final TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t1start - ONE_SECOND, SCALE),
-                new TmfTimestamp(t2end + ONE_SECOND, SCALE));
+                TmfTimestamp.fromNanos(t1start - ONE_SECOND),
+                TmfTimestamp.fromNanos(t2end + ONE_SECOND));
         selectWindowRange(range);
 
         TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
@@ -704,8 +702,8 @@ public class TmfTraceManagerTest {
         openTrace(exp);
 
         final TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t1end + ONE_SECOND, SCALE),
-                new TmfTimestamp(t2start - ONE_SECOND, SCALE));
+                TmfTimestamp.fromNanos(t1end + ONE_SECOND),
+                TmfTimestamp.fromNanos(t2start - ONE_SECOND));
         selectWindowRange(range);
 
         TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
@@ -739,6 +737,6 @@ public class TmfTraceManagerTest {
     private static @NonNull ITmfTimestamp calculateOffset(ITmfTimestamp initialTs, ITmfTimestamp offsetTs) {
         long start = initialTs.toNanos();
         long offset = offsetTs.toNanos();
-        return new TmfTimestamp(start + offset, SCALE);
+        return TmfTimestamp.fromNanos(start + offset);
     }
 }
index 5f079dc688abed693061978ebd2b78280ed44665..c96f2217568dad0dbc7889ec07482dbf6deff087 100644 (file)
@@ -33,7 +33,6 @@ import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
 import org.eclipse.tracecompass.tmf.core.signal.TmfEndSynchSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignal;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
@@ -161,7 +160,7 @@ public class CtfTmfTraceTest {
      */
     @Test
     public void testSeekEventLoc_timetamp() {
-        CtfLocation loc = new CtfLocation(new TmfNanoTimestamp(0L));
+        CtfLocation loc = new CtfLocation(TmfTimestamp.fromNanos(0L));
         fixture.seekEvent(loc);
         assertNotNull(fixture);
     }
@@ -361,7 +360,7 @@ public class CtfTmfTraceTest {
      */
     @Test
     public void testSeekEvent_timestamp() {
-        ITmfTimestamp timestamp = new TmfTimestamp();
+        ITmfTimestamp timestamp = TmfTimestamp.create(0, ITmfTimestamp.SECOND_SCALE);
         ITmfContext result = fixture.seekEvent(timestamp);
         assertNotNull(result);
         result.dispose();
index 32e7d8ed1af918105b2c5ed5e3727edcd29b7fb6..596ae423d45dc04753ba80d72af67750a5a574ea 100644 (file)
@@ -36,7 +36,8 @@ import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
 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.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.ctf.core.CtfConstants;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
@@ -117,7 +118,7 @@ public class CtfTmfEvent extends TmfEvent
      */
     protected CtfTmfEvent(CtfTmfTrace trace,
             long rank,
-            TmfNanoTimestamp timestamp,
+            ITmfTimestamp timestamp,
             String channel,
             int cpu,
             IEventDeclaration declaration,
@@ -159,7 +160,7 @@ public class CtfTmfEvent extends TmfEvent
     CtfTmfEvent(CtfTmfTrace trace) {
         super(trace,
                 ITmfContext.UNKNOWN_RANK,
-                new TmfNanoTimestamp(-1),
+                TmfTimestamp.fromNanos(-1),
                 null,
                 new TmfEventField("", null, new CtfTmfEventField[0])); //$NON-NLS-1$
         fSourceCpu = -1;
index 292870b71252be4b7943748d981296b58a99277b..e27e6b63245c8118bfe08b21a28249c368d88a35 100644 (file)
@@ -19,7 +19,7 @@ import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
 import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
 import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
@@ -81,7 +81,7 @@ public class CtfTmfEventFactory {
         /* Prepare what to pass to CtfTmfEvent's constructor */
         final IEventDeclaration eventDecl = eventDef.getDeclaration();
         final long ts = eventDef.getTimestamp();
-        final TmfNanoTimestamp timestamp = trace.createTimestamp(trace.timestampCyclesToNanos(ts));
+        final ITmfTimestamp timestamp = trace.createTimestamp(trace.timestampCyclesToNanos(ts));
 
         int sourceCPU = eventDef.getCPU();
 
@@ -126,7 +126,7 @@ public class CtfTmfEventFactory {
             IEventDefinition eventDef,
             final IEventDeclaration eventDecl,
             final long ts,
-            final TmfNanoTimestamp timestamp,
+            final ITmfTimestamp timestamp,
             int sourceCPU,
             String fileName) {
 
@@ -142,7 +142,7 @@ public class CtfTmfEventFactory {
         }
         long nbLostEvents = ((IntegerDefinition) nbLostEventsDef).getValue();
         long duration = ((IntegerDefinition) durationDef).getValue();
-        TmfNanoTimestamp timestampEnd = trace.createTimestamp(
+        ITmfTimestamp timestampEnd = trace.createTimestamp(
                 trace.timestampCyclesToNanos(ts) + duration);
 
         CtfTmfLostEvent lostEvent = new CtfTmfLostEvent(trace,
index ccd505ee641b8a1a13d3c6d92bce2c9ff568a819..4fdf6bbfa5fb65ebebc23ad5701d342b740b285f 100644 (file)
@@ -19,7 +19,6 @@ import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
 import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.tmf.core.event.ITmfLostEvent;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
 
@@ -68,7 +67,7 @@ public class CtfTmfLostEvent extends CtfTmfEvent implements ITmfLostEvent {
          * Only the factory should call this method, the cast to
          * (TmfNanoTimestamp) should be safe.
          */
-        super(trace, rank, (TmfNanoTimestamp) timeRange.getStartTime(), fileName, cpu, declaration, def);
+        super(trace, rank, timeRange.getStartTime(), fileName, cpu, declaration, def);
         fTimeRange = timeRange;
         fNbLost = nbLost;
     }
index 03bb239088d7f135f56f17db56b8379b9be9d78f..9ed272eaa956c9f486ddbd51c1adfdcf613ba964 100644 (file)
@@ -50,7 +50,6 @@ import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
 import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.tracecompass.tmf.core.project.model.ITmfPropertiesProvider;
 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.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTraceWithPreDefinedEvents;
@@ -626,8 +625,8 @@ public class CtfTmfTrace extends TmfTrace
      * @since 1.0
      */
     @Override
-    public @NonNull TmfNanoTimestamp createTimestamp(long ts) {
-        return new TmfNanoTimestamp(getTimestampTransform().transform(ts));
+    public @NonNull ITmfTimestamp createTimestamp(long ts) {
+        return TmfTimestamp.fromNanos(getTimestampTransform().transform(ts));
     }
 
     private static int fCheckpointSize = -1;
@@ -635,7 +634,7 @@ public class CtfTmfTrace extends TmfTrace
     @Override
     public synchronized int getCheckpointSize() {
         if (fCheckpointSize == -1) {
-            TmfCheckpoint c = new TmfCheckpoint(new TmfNanoTimestamp(0), new CtfLocation(0, 0), 0);
+            TmfCheckpoint c = new TmfCheckpoint(TmfTimestamp.fromNanos(0), new CtfLocation(0, 0), 0);
             ByteBuffer b = ByteBuffer.allocate(ITmfCheckpoint.MAX_SERIALIZE_SIZE);
             b.clear();
             c.serialize(b);
index e0ed0d4a1955bedbe4a842707fbefd9e7f86d8d5..9d43c85fa41c770f3c9412a634153fe9d6bd369c 100644 (file)
@@ -2220,13 +2220,13 @@ To add time information in sequence diagram the timestamp has to be set for each
 <pre>
     private void createFrame() {
         //...
-        start.setTime(new TmfTimestamp(1000, -3));
-        syn1.setTime(new TmfTimestamp(1005, -3));
-        synReturn1.setTime(new TmfTimestamp(1050, -3));
-        asyn1.setStartTime(new TmfTimestamp(1060, -3));
-        asyn1.setEndTime(new TmfTimestamp(1070, -3));
-        asynReturn1.setStartTime(new TmfTimestamp(1060, -3));
-        asynReturn1.setEndTime(new TmfTimestamp(1070, -3));
+        start.setTime(TmfTimestamp.create(1000, -3));
+        syn1.setTime(TmfTimestamp.create(1005, -3));
+        synReturn1.setTime(TmfTimestamp.create(1050, -3));
+        asyn1.setStartTime(TmfTimestamp.create(1060, -3));
+        asyn1.setEndTime(TmfTimestamp.create(1070, -3));
+        asynReturn1.setStartTime(TmfTimestamp.create(1060, -3));
+        asynReturn1.setEndTime(TmfTimestamp.create(1070, -3));
         //...
     }
 </pre>
index 8fe74a5e7e58f343df9115cff230724a51923243..b45f7941846c185e46fb4997b0c6a09ca5b55037 100644 (file)
@@ -102,7 +102,7 @@ import org.eclipse.ui.ide.IDE;
 
 /**
  * Adaptor to access GDB Tracepoint frames, previously collected and saved in a
- * file by GDB.  One instance of this maps to a single DSF-GDB session.
+ * file by GDB. One instance of this maps to a single DSF-GDB session.
  * <p>
  * This class offers the functions of starting a post-mortem GDB session with a
  * tracepoint data file, navigate the data frames and return the data contained
@@ -140,9 +140,9 @@ public class DsfGdbAdaptor {
     private String fTraceFile = ""; //$NON-NLS-1$
     private String sourceLocator = ""; //$NON-NLS-1$
 
-    // To save tracepoints detailed info.  The key is the rank of the
+    // To save tracepoints detailed info. The key is the rank of the
     // breakpoint (tracepoint is a kind of breakpoint)
-    private  Map<Integer, MIBreakpointDMData> fTpInfo = new HashMap<>();
+    private Map<Integer, MIBreakpointDMData> fTpInfo = new HashMap<>();
 
     private TmfEventType tmfEventType = new TmfEventType("GDB Tracepoint", TmfEventField.makeRoot(new String[] { "Content" })); //$NON-NLS-1$ //$NON-NLS-2$
 
@@ -157,10 +157,11 @@ public class DsfGdbAdaptor {
      * about the launchers or a change in debug context that we might need to
      * react-to.
      * <p>
+     *
      * @author Francois Chouinard
      */
     private class DsfGdbPlatformEventListener implements
-    ILaunchesListener2, IDebugContextListener {
+            ILaunchesListener2, IDebugContextListener {
 
         /**
          *
@@ -209,7 +210,7 @@ public class DsfGdbAdaptor {
                         IDMContext context = (IDMContext) contextObject;
                         if (context != null) {
                             String sessionId;
-                            synchronized(SESSION_LOCK) {
+                            synchronized (SESSION_LOCK) {
                                 sessionId = context.getSessionId();
                                 if (sessionId.equals(fCurrentSessionId)) {
                                     return;
@@ -226,7 +227,7 @@ public class DsfGdbAdaptor {
                                     final ICommandControlService commandControl = tracker.getService(ICommandControlService.class);
                                     if (traceControl != null && commandControl != null) {
                                         ITraceTargetDMContext traceContext = (ITraceTargetDMContext) commandControl.getContext();
-                                        traceControl.getCurrentTraceRecordContext(traceContext,    queryRm);
+                                        traceControl.getCurrentTraceRecordContext(traceContext, queryRm);
                                     } else {
                                         queryRm.done();
                                     }
@@ -368,23 +369,23 @@ public class DsfGdbAdaptor {
         return fNumberOfFrames;
     }
 
-
     /**
      * Wrapper around the selecting of a frame and the reading of its
      * information. this is a work-around for the potential problem of
-     * concurrent access to these functions by more than one thread,
-     * where two clients might interfere with each other.
+     * concurrent access to these functions by more than one thread, where two
+     * clients might interfere with each other.
      * <p>
-     * Note: We also try to get the tracepoint info here, if it's not
-     * already filled-in.
+     * Note: We also try to get the tracepoint info here, if it's not already
+     * filled-in.
      *
-     * @param  rank a long corresponding to the number of the frame to be
-     * selected and read
+     * @param rank
+     *            a long corresponding to the number of the frame to be selected
+     *            and read
      * @return A GdbTraceEvent object, or null in case of failure.
      */
     public synchronized GdbTraceEvent selectAndReadFrame(final long rank) {
         // lazy init of tracepoints info
-        if(fTpInfo.isEmpty()) {
+        if (fTpInfo.isEmpty()) {
             getTracepointInfo();
         }
         if (selectDataFrame(rank, false)) {
@@ -397,7 +398,6 @@ public class DsfGdbAdaptor {
         return null;
     }
 
-
     /**
      * This class implements a best-effort look-up of the detailed tracepoint
      * information (source code filename, line number, etc...).
@@ -568,11 +568,13 @@ public class DsfGdbAdaptor {
     }
 
     /**
-     * This method uses the DSF-GDB interface to select a given frame number
-     * in the current GDB tracepoint session.
+     * This method uses the DSF-GDB interface to select a given frame number in
+     * the current GDB tracepoint session.
      *
-     * @param rank the rank of the tracepoint frame to select.
-     * @param update true if visualization should be updated
+     * @param rank
+     *            the rank of the tracepoint frame to select.
+     * @param update
+     *            true if visualization should be updated
      * @return boolean true if select worked.
      */
     public boolean selectDataFrame(final long rank, final boolean update) {
@@ -728,11 +730,10 @@ public class DsfGdbAdaptor {
 
             // get corresponding TP data
             String tmfEventRef;
-            MIBreakpointDMData bp =  fTpInfo.get(Integer.valueOf(data.getTracepointNumber()));
+            MIBreakpointDMData bp = fTpInfo.get(Integer.valueOf(data.getTracepointNumber()));
             if (bp != null) {
                 tmfEventRef = bp.getFileName() + ":" + bp.getLineNumber() + " :: " + bp.getFunctionName(); //$NON-NLS-1$ //$NON-NLS-2$
-            }
-            else {
+            } else {
                 tmfEventRef = tracedExecutable;
             }
 
@@ -742,7 +743,7 @@ public class DsfGdbAdaptor {
                     Integer.parseInt(data.getRecordId()));
 
             GdbTraceEvent ev = new GdbTraceEvent(fGdbTrace,
-                    new TmfTimestamp(Integer.parseInt(data.getRecordId())),
+                    TmfTimestamp.fromSeconds(Integer.parseInt(data.getRecordId())),
                     "Tracepoint: " + data.getTracepointNumber() + ", Frame: " + data.getRecordId(),  //$NON-NLS-1$ //$NON-NLS-2$
                     tmfEventType,
                     evContent,
@@ -769,20 +770,22 @@ public class DsfGdbAdaptor {
      * This is a helper method for getTraceFrameData, to create for it a
      * "best effort" GdbTraceEvent when a problem occurs during the reading.
      *
-     * @param rank long containing the number of the frame where the problem occurred
-     * @param message String containing a brief explanation of problem.
+     * @param rank
+     *            long containing the number of the frame where the problem
+     *            occurred
+     * @param message
+     *            String containing a brief explanation of problem.
      * @return a GdbTraceEvent object, filled as best as possible
      */
     private GdbTraceEvent createExceptionEvent(final long rank, final String message) {
         // get corresponding TP data
         String tmfEventRef;
         String tmfEventSrc;
-        MIBreakpointDMData bp =  fTpInfo.get(rank);
+        MIBreakpointDMData bp = fTpInfo.get(rank);
         if (bp != null) {
             tmfEventRef = bp.getFileName() + ":" + bp.getLineNumber() + " :: " + bp.getFunctionName(); //$NON-NLS-1$ //$NON-NLS-2$
             tmfEventSrc = bp.getFileName() + " :: " + bp.getFunctionName() + ", line: " + bp.getLineNumber(); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-        else {
+        } else {
             tmfEventRef = tracedExecutable;
             tmfEventSrc = "Tracepoint: n/a"; //$NON-NLS-1$
         }
@@ -790,7 +793,7 @@ public class DsfGdbAdaptor {
         GdbTraceEventContent evContent = new GdbTraceEventContent("ERROR: " + message, 0, 0); //$NON-NLS-1$
 
         GdbTraceEvent ev = new GdbTraceEvent(fGdbTrace,
-                new TmfTimestamp(rank),
+                TmfTimestamp.fromSeconds(rank),
                 tmfEventSrc,
                 tmfEventType,
                 evContent,
index 588fd48bf3c45a8d66dc0c4e46e05e8a7f269e9b..0562a5ded78bcf529e30b37664c381be043903cd 100644 (file)
@@ -27,8 +27,8 @@ import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEvent;
 import org.eclipse.tracecompass.internal.gdbtrace.core.event.GdbTraceEventContent;
 import org.eclipse.tracecompass.internal.gdbtrace.core.trace.GdbEventAspects;
 import org.eclipse.tracecompass.internal.gdbtrace.core.trace.GdbTrace;
-import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
index 3ee3f1ee39ad8afce3133746a3116f83e7011eae..edbc389fa765a9a765fc8be718cace75194ed0d5 100644 (file)
@@ -11,7 +11,6 @@ package org.eclipse.tracecompass.lttng2.common.core.tests;
 
 import static org.junit.Assert.assertNotNull;
 
-import org.eclipse.tracecompass.internal.lttng2.common.core.Activator;
 import org.junit.Test;
 
 /**
index 8199b315eaeff6861bbbf5f2f823f1ba12e01398..96971926f99461dd91b0dbdb90057f31b70a189b 100644 (file)
 
 package org.eclipse.tracecompass.lttng2.control.core.tests.model.impl;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.util.LinkedList;
 import java.util.List;
index 0e3b24728e27804b99d043ee524ace9b2b3bc477..64eb6fd72f9544359558dc7973caed712c7a9042 100644 (file)
 
 package org.eclipse.tracecompass.lttng2.control.core.tests.model.impl;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.util.LinkedList;
 import java.util.List;
index 13ddb54bdaeecfed4ef360432d3eb06a5c83c9ab..9d6366150bab53d018707b179f5ffd1c2313c1f6 100644 (file)
 
 package org.eclipse.tracecompass.lttng2.control.core.tests.model.impl;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.util.LinkedList;
 import java.util.List;
index 22f37ecf50ee9225ec2565ccb0bfd723922a03f5..9182a18b4284109dab9689a82ee2a1fcdb3f77fe 100644 (file)
 
 package org.eclipse.tracecompass.lttng2.control.core.tests.model.impl;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.IFieldInfo;
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.impl.FieldInfo;
index caa8d519cdb2b48078394fbb82c8fabe51c2e7fc..af311ff626e6627040f53e6a964908becbeb4416 100644 (file)
 
 package org.eclipse.tracecompass.lttng2.control.core.tests.model.impl;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.IProbeEventInfo;
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceEnablement;
index 3d50aa5a77649bc5751b7e1b3d6e6a848892b267..bb25c07f0fd5ad1e68a7169f620c71a56244094f 100644 (file)
 
 package org.eclipse.tracecompass.lttng2.control.core.tests.model.impl;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.util.LinkedList;
 import java.util.List;
index 0099c8a564ab78982f2f31f8889ca05d1b2d6fd1..b812049aabeb9264d3762be1864a50ef06141f5d 100644 (file)
 
 package org.eclipse.tracecompass.lttng2.control.core.tests.model.impl;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.util.LinkedList;
 import java.util.List;
index de65c38fddc72ee2262306db92c7e7cc4da9f5a7..caa3cf96073caf846e8a8b399a601e6267d741df 100644 (file)
@@ -36,8 +36,9 @@ import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.commands.Str
 import org.eclipse.tracecompass.internal.lttng2.control.core.relayd.impl.LttngRelaydConnectorFactory;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.Activator;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceRangeUpdatedSignal;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
 
 /**
@@ -184,7 +185,7 @@ public final class LttngRelaydConsumer {
                                 if (indexReply.getStatus() == NextIndexReturnCode.VIEWER_INDEX_OK) {
                                     long nanoTimeStamp = fCtfTmfTrace.timestampCyclesToNanos(indexReply.getTimestampEnd());
                                     if (nanoTimeStamp > fTimestampEnd) {
-                                        TmfNanoTimestamp endTime = new TmfNanoTimestamp(nanoTimeStamp);
+                                        ITmfTimestamp endTime = TmfTimestamp.fromNanos(nanoTimeStamp);
                                         TmfTimeRange range = new TmfTimeRange(fCtfTmfTrace.getStartTime(), endTime);
 
                                         long currentTime = System.nanoTime();
@@ -198,7 +199,7 @@ public final class LttngRelaydConsumer {
                                 } else if (indexReply.getStatus() == NextIndexReturnCode.VIEWER_INDEX_HUP) {
                                     // The trace is now complete because the trace session was destroyed
                                     fCtfTmfTrace.setComplete(true);
-                                    TmfTraceRangeUpdatedSignal signal = new TmfTraceRangeUpdatedSignal(LttngRelaydConsumer.this, fCtfTmfTrace, new TmfTimeRange(fCtfTmfTrace.getStartTime(), new TmfNanoTimestamp(fTimestampEnd)));
+                                    TmfTraceRangeUpdatedSignal signal = new TmfTraceRangeUpdatedSignal(LttngRelaydConsumer.this, fCtfTmfTrace, new TmfTimeRange(fCtfTmfTrace.getStartTime(), TmfTimestamp.fromNanos(fTimestampEnd)));
                                     fCtfTmfTrace.broadcastAsync(signal);
                                     return Status.OK_STATUS;
                                 }
index 12b265c18ad2e0f43c9327e2f74ba76ea49eee0e..f148900e8312bb998626a3b1183134c5a4adee0c 100644 (file)
 
 package org.eclipse.tracecompass.lttng2.kernel.core.tests;
 
-import junit.framework.TestCase;
-
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import junit.framework.TestCase;
+
 /**
  * <b><u>ActivatorTest</u></b>
  * <p>
index 3f9d876fb7aeb7d306d21ab6f3405b5d2956b0a1..f83d219fe448158b684c9ca188660e198b049396 100644 (file)
@@ -86,7 +86,7 @@ public class ControlFlowViewSortingTest extends KernelTestBase {
     private static final long LTTNG_CONSUMER_BIRTHTIME = 1361214078963717040L;
     private static final String LTTNG_CONSUMER_TID = "4034";
 
-    private static final @NonNull TmfTimestamp TRACE_START_TIME = new TmfTimestamp(1361214078963711320L, ITmfTimestamp.NANOSECOND_SCALE);
+    private static final @NonNull ITmfTimestamp TRACE_START_TIME = TmfTimestamp.create(1361214078963711320L, ITmfTimestamp.NANOSECOND_SCALE);
 
     // ------------------------------------------------------------------------
     // Attributes
index af93327d180fab86e3fb255d73a10dca8a7e0c27..1e7bca28a03330b1e500e9343e8aba427aae7794 100644 (file)
@@ -34,8 +34,8 @@ import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
 import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
 import org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView;
@@ -68,18 +68,18 @@ public class ControlFlowViewTest extends KernelTestBase {
     private static final String SELECT_PREVIOUS_EVENT = "Select Previous Event";
     private static final String SELECT_NEXT_EVENT = "Select Next Event";
     private static final Keyboard KEYBOARD = KeyboardFactory.getSWTKeyboard();
-    private static final @NonNull ITmfTimestamp START_TIME = new TmfNanoTimestamp(1368000272650993664L);
-    private static final @NonNull ITmfTimestamp TID1_TIME1 = new TmfNanoTimestamp(1368000272651208412L);
-    private static final @NonNull ITmfTimestamp TID1_TIME2 = new TmfNanoTimestamp(1368000272656147616L);
-    private static final @NonNull ITmfTimestamp TID1_TIME3 = new TmfNanoTimestamp(1368000272656362364L);
-    private static final @NonNull ITmfTimestamp TID1_TIME4 = new TmfNanoTimestamp(1368000272663234300L);
-    private static final @NonNull ITmfTimestamp TID1_TIME5 = new TmfNanoTimestamp(1368000272663449048L);
-    private static final @NonNull ITmfTimestamp TID1_TIME6 = new TmfNanoTimestamp(1368000272665596528L);
-    private static final @NonNull ITmfTimestamp TID2_TIME1 = new TmfNanoTimestamp(1368000272651852656L);
-    private static final @NonNull ITmfTimestamp TID2_TIME2 = new TmfNanoTimestamp(1368000272652067404L);
-    private static final @NonNull ITmfTimestamp TID2_TIME3 = new TmfNanoTimestamp(1368000272652282152L);
-    private static final @NonNull ITmfTimestamp TID2_TIME4 = new TmfNanoTimestamp(1368000272652496900L);
-    private static final @NonNull ITmfTimestamp TID5_TIME1 = new TmfNanoTimestamp(1368000272652496900L);
+    private static final @NonNull ITmfTimestamp START_TIME = TmfTimestamp.fromNanos(1368000272650993664L);
+    private static final @NonNull ITmfTimestamp TID1_TIME1 = TmfTimestamp.fromNanos(1368000272651208412L);
+    private static final @NonNull ITmfTimestamp TID1_TIME2 = TmfTimestamp.fromNanos(1368000272656147616L);
+    private static final @NonNull ITmfTimestamp TID1_TIME3 = TmfTimestamp.fromNanos(1368000272656362364L);
+    private static final @NonNull ITmfTimestamp TID1_TIME4 = TmfTimestamp.fromNanos(1368000272663234300L);
+    private static final @NonNull ITmfTimestamp TID1_TIME5 = TmfTimestamp.fromNanos(1368000272663449048L);
+    private static final @NonNull ITmfTimestamp TID1_TIME6 = TmfTimestamp.fromNanos(1368000272665596528L);
+    private static final @NonNull ITmfTimestamp TID2_TIME1 = TmfTimestamp.fromNanos(1368000272651852656L);
+    private static final @NonNull ITmfTimestamp TID2_TIME2 = TmfTimestamp.fromNanos(1368000272652067404L);
+    private static final @NonNull ITmfTimestamp TID2_TIME3 = TmfTimestamp.fromNanos(1368000272652282152L);
+    private static final @NonNull ITmfTimestamp TID2_TIME4 = TmfTimestamp.fromNanos(1368000272652496900L);
+    private static final @NonNull ITmfTimestamp TID5_TIME1 = TmfTimestamp.fromNanos(1368000272652496900L);
 
     private SWTBotView fViewBot;
 
index 2075db36042329cd3d44557a3479a88bfd11d154..c3fa7469c6f11f15e11e739e84ff9a0469f08096 100644 (file)
@@ -34,8 +34,8 @@ import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
 import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
 import org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl;
@@ -62,18 +62,18 @@ public class ResourcesViewTest extends KernelTestBase {
     private static final String LOST_EVENTS = "Lost Events";
     private static final String OK = "OK";
     private static final Keyboard KEYBOARD = KeyboardFactory.getSWTKeyboard();
-    private static final @NonNull ITmfTimestamp START_TIME = new TmfNanoTimestamp(1368000272650993664L);
-    private static final @NonNull ITmfTimestamp LOST_EVENT_TIME1 = new TmfNanoTimestamp(1368000272681793477L);
-    private static final @NonNull ITmfTimestamp LOST_EVENT_END1 = new TmfNanoTimestamp(1368000272681793477L + 7425331L);
-    private static final @NonNull ITmfTimestamp LOST_EVENT_TIME2 = new TmfNanoTimestamp(1368000272820875850L);
-    private static final @NonNull ITmfTimestamp LOST_EVENT_END2 = new TmfNanoTimestamp(1368000272820875850L + 6640670L);
-    private static final @NonNull ITmfTimestamp LOST_EVENT_TIME3 = new TmfNanoTimestamp(1368000272882715015L);
-    private static final @NonNull ITmfTimestamp LOST_EVENT_END3 = new TmfNanoTimestamp(1368000272882715015L + 11373385L);
-    private static final @NonNull ITmfTimestamp CPU0_TIME1 = new TmfNanoTimestamp(1368000272651208412L);
-    private static final @NonNull ITmfTimestamp CPU0_TIME2 = new TmfNanoTimestamp(1368000272651852656L);
-    private static final @NonNull ITmfTimestamp CPU0_TIME3 = new TmfNanoTimestamp(1368000272652067404L);
-    private static final @NonNull ITmfTimestamp CPU0_TIME4 = new TmfNanoTimestamp(1368000272652282152L);
-    private static final @NonNull ITmfTimestamp CPU0_TIME5 = new TmfNanoTimestamp(1368000272653141144L);
+    private static final @NonNull ITmfTimestamp START_TIME = TmfTimestamp.fromNanos(1368000272650993664L);
+    private static final @NonNull ITmfTimestamp LOST_EVENT_TIME1 = TmfTimestamp.fromNanos(1368000272681793477L);
+    private static final @NonNull ITmfTimestamp LOST_EVENT_END1 = TmfTimestamp.fromNanos(1368000272681793477L + 7425331L);
+    private static final @NonNull ITmfTimestamp LOST_EVENT_TIME2 = TmfTimestamp.fromNanos(1368000272820875850L);
+    private static final @NonNull ITmfTimestamp LOST_EVENT_END2 = TmfTimestamp.fromNanos(1368000272820875850L + 6640670L);
+    private static final @NonNull ITmfTimestamp LOST_EVENT_TIME3 = TmfTimestamp.fromNanos(1368000272882715015L);
+    private static final @NonNull ITmfTimestamp LOST_EVENT_END3 = TmfTimestamp.fromNanos(1368000272882715015L + 11373385L);
+    private static final @NonNull ITmfTimestamp CPU0_TIME1 = TmfTimestamp.fromNanos(1368000272651208412L);
+    private static final @NonNull ITmfTimestamp CPU0_TIME2 = TmfTimestamp.fromNanos(1368000272651852656L);
+    private static final @NonNull ITmfTimestamp CPU0_TIME3 = TmfTimestamp.fromNanos(1368000272652067404L);
+    private static final @NonNull ITmfTimestamp CPU0_TIME4 = TmfTimestamp.fromNanos(1368000272652282152L);
+    private static final @NonNull ITmfTimestamp CPU0_TIME5 = TmfTimestamp.fromNanos(1368000272653141144L);
     private static final int TOP_MARGIN = 1;
     private static final Point TOGGLE_SIZE = new Point(7, 8);
     private static final Point HIDE_SIZE = new Point(16, 16);
index 53dbe91a7a8535cf3452ad2184d3bd0e935c2fe9..aa7ec43ac71dd889c5e7cd81deaf2bc72a52a9dc 100644 (file)
 
 package org.eclipse.tracecompass.lttng2.ust.core.tests;
 
-import junit.framework.TestCase;
-
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import junit.framework.TestCase;
+
 /**
  * <b><u>ActivatorTest</u></b>
  * <p>
index e823405bcae5df2403a584b0de393840cfdd0341..38fa890a7ec860c2fe24c0cc2473710a51ade070 100644 (file)
@@ -16,7 +16,7 @@ import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoSourceAspect;
 import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfCallsite;
 import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfSourceLookup;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
 
@@ -56,7 +56,7 @@ public class LttngUstEvent extends CtfTmfEvent implements ITmfSourceLookup {
      * @param eventDefinition
      *            The event definition
      */
-    protected LttngUstEvent(CtfTmfTrace trace, long rank, TmfNanoTimestamp timestamp,
+    protected LttngUstEvent(CtfTmfTrace trace, long rank, ITmfTimestamp timestamp,
             String channel, int cpu, IEventDeclaration declaration, IEventDefinition eventDefinition) {
         super(trace, rank, timestamp, channel, cpu, declaration, eventDefinition);
     }
index 4e8dd9c45684f4960ff787024089e85c1894c0d3..bfc658016ef05603cdb0218e5c2d195a739b765f 100644 (file)
@@ -14,7 +14,7 @@ import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.ctf.core.CTFStrings;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
 import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
 import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventFactory;
@@ -47,7 +47,7 @@ public class LttngUstEventFactory extends CtfTmfEventFactory {
         /* Prepare what to pass to CtfTmfEvent's constructor */
         final IEventDeclaration eventDecl = eventDef.getDeclaration();
         final long ts = eventDef.getTimestamp();
-        final TmfNanoTimestamp timestamp = trace.createTimestamp(trace.timestampCyclesToNanos(ts));
+        final ITmfTimestamp timestamp = trace.createTimestamp(trace.timestampCyclesToNanos(ts));
 
         int sourceCPU = eventDef.getCPU();
 
index 0e517f813217b7293eeb13f65410e944b4a03f30..50fe209b932262e989f83af50878e3eb4da11ab9 100644 (file)
@@ -35,7 +35,7 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
 import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTraceUtils;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
@@ -287,7 +287,7 @@ public class CallStackViewTest {
     private static void goToTime(long timestamp) {
         SWTBotTable table = fBot.activeEditor().bot().table();
         table.setFocus();
-        TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(table.widget, new TmfNanoTimestamp(timestamp)));
+        TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(table.widget, TmfTimestamp.fromNanos(timestamp)));
         fBot.waitUntil(ConditionHelpers.selectionInEventsTable(fBot, timestamp));
     }
 
index 2a2b3dcef3e11b4e00ab646f6877ff06bff0cd95..0b7cf434b70a97f5c7add22872ecb4b2a8dacf0b 100644 (file)
@@ -12,7 +12,8 @@
 
 package org.eclipse.tracecompass.tmf.pcap.core.tests.event;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeTrue;
 
 import java.io.IOException;
index b4809ea3ae6e9d91518cceab668be4daf7b5724f..6fdd39beb582f06fd82965950cfef479166ea585 100644 (file)
@@ -133,7 +133,7 @@ public class TmfPacketStream {
      * @return The start time.
      */
     public synchronized ITmfTimestamp getStartTime() {
-        return new TmfTimestamp(fPacketStream.getStartTime(), ITmfTimestamp.NANOSECOND_SCALE);
+        return TmfTimestamp.fromNanos(fPacketStream.getStartTime());
     }
 
     /**
@@ -142,7 +142,7 @@ public class TmfPacketStream {
      * @return The stop time.
      */
     public synchronized ITmfTimestamp getStopTime() {
-        return new TmfTimestamp(fPacketStream.getStopTime(), ITmfTimestamp.NANOSECOND_SCALE);
+        return TmfTimestamp.fromNanos(fPacketStream.getStopTime());
     }
 
     /**
index 5bbac26769424293fdc804127bfcffc13d445e66..f5efb7c075197b3286cf88a3910fc70c42a0be0d 100644 (file)
@@ -72,11 +72,11 @@ public class PcapEventFactory {
         switch (scale) {
         case MICROSECOND:
             long us = trace.getTimestampTransform().transform(timestamp * 1000) / 1000;
-            tmfTimestamp = new TmfTimestamp(us, ITmfTimestamp.MICROSECOND_SCALE);
+            tmfTimestamp = TmfTimestamp.fromMicros(us);
             break;
         case NANOSECOND:
             long ns = trace.getTimestampTransform().transform(timestamp);
-            tmfTimestamp = new TmfTimestamp(ns, ITmfTimestamp.NANOSECOND_SCALE);
+            tmfTimestamp = TmfTimestamp.fromNanos(ns);
             break;
         default:
             throw new IllegalArgumentException("The timestamp precision is not valid!"); //$NON-NLS-1$
index ee5922cc27b4234d169785c82de0bedf9eb58347..e38b28caafd9928dc2624a97f6f766cd806d4158 100644 (file)
@@ -44,11 +44,11 @@ public class PatternSegmentFactoryStub {
     /**
      * Start event for pattern segment TEST_2
      */
-    public static final @NonNull ITmfEvent TEST_2_START_EVENT = new TmfEvent(null, ITmfContext.UNKNOWN_RANK, new TmfTimestamp(1, ITmfTimestamp.NANOSECOND_SCALE), null, null);
+    public static final @NonNull ITmfEvent TEST_2_START_EVENT = new TmfEvent(null, ITmfContext.UNKNOWN_RANK, TmfTimestamp.fromNanos(1), null, null);
     /**
      * end event for pattern segment TEST_2
      */
-    public static final @NonNull ITmfEvent TEST_2_END_EVENT = new TmfEvent(null, ITmfContext.UNKNOWN_RANK, new TmfTimestamp(10, ITmfTimestamp.NANOSECOND_SCALE), null, null);
+    public static final @NonNull ITmfEvent TEST_2_END_EVENT = new TmfEvent(null, ITmfContext.UNKNOWN_RANK, TmfTimestamp.fromNanos(10), null, null);
 
     /**
      * The pattern segment TEST_2
index 78c3edf1fb028f81e62e1d1a0e16f4592516c690..b80f0095ff749209691e965c490d8714cc87bed9 100644 (file)
@@ -77,7 +77,7 @@ public class TmfXmlPatternSegment implements ISegment {
      * @return The start timestamp
      */
     public @NonNull ITmfTimestamp getTimestampStart() {
-        return new TmfTimestamp(fStart, fScale);
+        return TmfTimestamp.create(fStart, fScale);
     }
 
     /**
@@ -86,7 +86,7 @@ public class TmfXmlPatternSegment implements ISegment {
      * @return The end timestamp
      */
     public @NonNull ITmfTimestamp getTimestampEnd() {
-        return new TmfTimestamp(fEnd, fScale);
+        return TmfTimestamp.create(fEnd, fScale);
     }
 
     /**
index 4bc3f9b756d991dba3a682399634b38e6bc36601..cec6c26594e2829fda77afa195a63fad6ac48ebe 100644 (file)
@@ -21,8 +21,8 @@ import java.util.HashSet;
 import java.util.Set;
 
 import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisRequirement.ValuePriorityLevel;
 import org.eclipse.tracecompass.tmf.core.analysis.requirements.IAnalysisRequirementProvider;
+import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisRequirement.ValuePriorityLevel;
 import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisRequirementHelper;
 import org.eclipse.tracecompass.tmf.tests.stubs.analysis.AnalysisModuleTestHelper;
 import org.eclipse.tracecompass.tmf.tests.stubs.analysis.AnalysisModuleTestHelper.moduleStubEnum;
index 4daf2a91099560e96facf9bc1d1cc44673546c1e..fcf708aea45b65195b593724f90dd66f621da0d9 100644 (file)
 
 package org.eclipse.tracecompass.tmf.core.tests.analysis.requirements;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
@@ -20,13 +26,6 @@ import java.util.Set;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisRequirement;
 import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisRequirement.ValuePriorityLevel;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
 import org.junit.Test;
 
 /**
index 0321c5e346150215b1d342f468a3ab1a420c34f6..895e71f169e3e14b32013d1ba67a9fc573983154 100644 (file)
@@ -24,10 +24,11 @@ import java.util.Vector;
 import org.eclipse.tracecompass.internal.tmf.core.component.TmfProviderManager;
 import org.eclipse.tracecompass.tmf.core.component.ITmfEventProvider;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
 import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest.ExecutionType;
+import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
 import org.eclipse.tracecompass.tmf.core.signal.TmfEndSynchSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfStartSynchSignal;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.tests.stubs.component.TmfEventProviderStub;
@@ -303,8 +304,8 @@ public class TmfEventProviderTest {
      */
     @Test
     public void testGetSyntheticEvents_TimeRange() {
-        TmfTimestamp start = new TmfTimestamp(1, (byte) -3);
-        TmfTimestamp end = new TmfTimestamp(1000, (byte) -3);
+        ITmfTimestamp start = TmfTimestamp.create(1, (byte) -3);
+        ITmfTimestamp end = TmfTimestamp.create(1000, (byte) -3);
         TmfTimeRange range = new TmfTimeRange(start, end);
         try {
             getSyntheticData(range, -1);
@@ -315,7 +316,7 @@ public class TmfEventProviderTest {
 
 //    public void testGetSyntheticEvents_WeirdTimeRange1() {
 //        TmfTimestamp start = TmfTimestamp.BigBang;
-//        TmfTimestamp end = TmfTimestamp.Zero; // new TmfTimestamp(0, (byte) -3,
+//        TmfTimestamp end = TmfTimestamp.Zero; // TmfTimestamp.create(0, (byte) -3,
 //                                              // 0);
 //        TmfTimeRange range = new TmfTimeRange(start, end);
 //        try {
@@ -326,7 +327,7 @@ public class TmfEventProviderTest {
 //    }
 
 //    public void testGetSyntheticEvents_WeirdTimeRange2() {
-//        TmfTimestamp start = TmfTimestamp.Zero; // new TmfTimestamp(0, (byte)
+//        TmfTimestamp start = TmfTimestamp.Zero; // TmfTimestamp.create(0, (byte)
 //                                                // -3, 0);
 //        TmfTimestamp end = TmfTimestamp.BigCrunch;
 //        TmfTimeRange range = new TmfTimeRange(start, end);
index b335b3f25d72f67eb67f04086d6f746dc04cfceb..3d66ed4e0c7c4f8b388fc37d2e9da8b0e135ffd5 100644 (file)
@@ -27,6 +27,7 @@ import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
 import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
@@ -61,7 +62,7 @@ public class TmfEventTest {
     private final ITmfEventField[] fFields1 = new ITmfEventField[] { fField1a, fField1b };
     private final @NonNull String fRawContent1 = fField1a.toString() + fField1b.toString();
     private final ITmfEventField fContent1 = new TmfEventField(fRawContent1, null, fFields1);
-    private final TmfTimestamp fTimestamp1 = new TmfTimestamp(12345, 2);
+    private final ITmfTimestamp fTimestamp1 = TmfTimestamp.create(12345, 2);
     private final @NonNull ITmfEvent fEvent1 = new TmfEvent(fTrace, 0, fTimestamp1, fType, fContent1);
 
     private final Object fValue2a = "Another string";
@@ -71,7 +72,7 @@ public class TmfEventTest {
     private final ITmfEventField[] fFields2 = new ITmfEventField[] { fField2a, fField2b };
     private final @NonNull String fRawContent2 = fField2a.toString() + fField2b.toString();
     private final ITmfEventField fContent2 = new TmfEventField(fRawContent2, null, fFields2);
-    private final TmfTimestamp fTimestamp2 = new TmfTimestamp(12350, 2);
+    private final ITmfTimestamp fTimestamp2 = TmfTimestamp.create(12350, 2);
     private final @NonNull ITmfEvent fEvent2 = new TmfEvent(fTrace, 1, fTimestamp2, fType, fContent2);
 
     // ------------------------------------------------------------------------
index 77fb2bb35d8185a932b17ad6a7497c3947d0c027..998c1f24a3b77ad9a155282a70652ae448914de8 100644 (file)
@@ -16,7 +16,6 @@ package org.eclipse.tracecompass.tmf.core.tests.event;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -37,7 +36,7 @@ public class TmfNanoTimestampTest {
     // Variables
     // ------------------------------------------------------------------------
 
-    private final ITmfTimestamp ts0 = new TmfNanoTimestamp();
+    private final ITmfTimestamp ts0 = new TmfNanoTimestamp(0);
     private final ITmfTimestamp ts1 = new TmfNanoTimestamp(12345);
     private final ITmfTimestamp ts2 = new TmfNanoTimestamp(-1234);
 
@@ -59,22 +58,12 @@ public class TmfNanoTimestampTest {
 
     @Test
     public void testCopyConstructor() {
-        final ITmfTimestamp copy = new TmfNanoTimestamp(ts1);
+        final long copy = ts1.toNanos();
 
-        assertEquals("getValue", ts1.getValue(), copy.getValue());
-        assertEquals("getscale", ts1.getScale(), copy.getScale());
+        assertEquals("getValue", ts1.getValue(), copy);
+        assertEquals("getscale", ts1.getScale(), -9);
 
-        assertEquals("getValue", 12345, copy.getValue());
-        assertEquals("getscale", -9, copy.getScale());
-    }
-
-    @Test
-    public void testCopyBadTimestamp() {
-        try {
-            new TmfNanoTimestamp(null);
-            fail("TmfNanoTimestamp: null argument");
-        } catch (final NullPointerException e) {
-        }
+        assertEquals("getValue", 12345, copy);
     }
 
     // ------------------------------------------------------------------------
@@ -99,25 +88,25 @@ public class TmfNanoTimestampTest {
 
     @Test
     public void testEqualsSymmetry() {
-        final ITmfTimestamp ts0copy = new TmfNanoTimestamp(ts0);
+        final ITmfTimestamp ts0copy = TmfTimestamp.fromNanos(ts0.toNanos());
         assertTrue("equals", ts0.equals(ts0copy));
         assertTrue("equals", ts0copy.equals(ts0));
 
-        final ITmfTimestamp ts1copy = new TmfNanoTimestamp(ts1);
+        final ITmfTimestamp ts1copy = TmfTimestamp.fromNanos(ts1.toNanos());
         assertTrue("equals", ts1.equals(ts1copy));
         assertTrue("equals", ts1copy.equals(ts1));
     }
 
     @Test
     public void testEqualsTransivity() {
-        final ITmfTimestamp ts0copy1 = new TmfNanoTimestamp(ts0);
-        final ITmfTimestamp ts0copy2 = new TmfNanoTimestamp(ts0copy1);
+        final ITmfTimestamp ts0copy1 = TmfTimestamp.fromNanos(ts0.toNanos());
+        final ITmfTimestamp ts0copy2 = TmfTimestamp.fromNanos(ts0copy1.toNanos());
         assertTrue("equals", ts0.equals(ts0copy1));
         assertTrue("equals", ts0copy1.equals(ts0copy2));
         assertTrue("equals", ts0.equals(ts0copy2));
 
-        final ITmfTimestamp ts1copy1 = new TmfNanoTimestamp(ts1);
-        final ITmfTimestamp ts1copy2 = new TmfNanoTimestamp(ts1copy1);
+        final ITmfTimestamp ts1copy1 = TmfTimestamp.fromNanos(ts1.toNanos());
+        final ITmfTimestamp ts1copy2 = TmfTimestamp.fromNanos(ts1copy1.toNanos());
         assertTrue("equals", ts1.equals(ts1copy1));
         assertTrue("equals", ts1copy1.equals(ts1copy2));
         assertTrue("equals", ts1.equals(ts1copy2));
@@ -156,13 +145,13 @@ public class TmfNanoTimestampTest {
 
     @Test
     public void testHashCode() {
-        final ITmfTimestamp ts0copy = new TmfTimestamp(ts0);
-        final ITmfTimestamp ts1copy = new TmfTimestamp(ts1);
-        final ITmfTimestamp ts2copy = new TmfTimestamp(ts2);
+        final ITmfTimestamp ts0copy = TmfTimestamp.create(ts0.getValue(), ts0.getScale());
+        final ITmfTimestamp ts1copy = TmfTimestamp.create(ts1.getValue(), ts1.getScale());
+        final ITmfTimestamp ts2copy = TmfTimestamp.create(ts2.getValue(), ts2.getScale());
 
-        assertTrue("hashCode", ts0.hashCode() == ts0copy.hashCode());
-        assertTrue("hashCode", ts1.hashCode() == ts1copy.hashCode());
-        assertTrue("hashCode", ts2.hashCode() == ts2copy.hashCode());
+        assertEquals("hashCode", ts0.hashCode(), ts0copy.hashCode());
+        assertEquals("hashCode", ts1.hashCode(), ts1copy.hashCode());
+        assertEquals("hashCode", ts2.hashCode(), ts2copy.hashCode());
 
         assertTrue("hashCode", ts0.hashCode() != ts1.hashCode());
     }
@@ -215,9 +204,9 @@ public class TmfNanoTimestampTest {
 
     @Test
     public void testBasicCompareTo() {
-        final ITmfTimestamp tstamp1 = new TmfNanoTimestamp(900);
-        final ITmfTimestamp tstamp2 = new TmfNanoTimestamp(1000);
-        final ITmfTimestamp tstamp3 = new TmfNanoTimestamp(1100);
+        final ITmfTimestamp tstamp1 = TmfTimestamp.fromNanos(900);
+        final ITmfTimestamp tstamp2 = TmfTimestamp.fromNanos(1000);
+        final ITmfTimestamp tstamp3 = TmfTimestamp.fromNanos(1100);
 
         assertTrue(tstamp1.compareTo(tstamp1) == 0);
 
@@ -233,9 +222,9 @@ public class TmfNanoTimestampTest {
 
     @Test
     public void testCompareTo() {
-        final ITmfTimestamp ts0a = new TmfTimestamp(0, 2);
-        final ITmfTimestamp ts1a = new TmfTimestamp(123450, -10);
-        final ITmfTimestamp ts2a = new TmfTimestamp(-12340, -10);
+        final ITmfTimestamp ts0a = TmfTimestamp.create(0, 2);
+        final ITmfTimestamp ts1a = TmfTimestamp.create(123450, -10);
+        final ITmfTimestamp ts2a = TmfTimestamp.create(-12340, -10);
 
         assertTrue(ts1.compareTo(ts1) == 0);
 
@@ -251,17 +240,17 @@ public class TmfNanoTimestampTest {
     @Test
     public void testDelta() {
         // Delta for same scale and precision (delta > 0)
-        TmfTimestamp tstamp0 = new TmfNanoTimestamp(10);
-        TmfTimestamp tstamp1 = new TmfNanoTimestamp(5);
-        TmfTimestamp expectd = new TmfNanoTimestamp(5);
+        ITmfTimestamp tstamp0 = TmfTimestamp.fromNanos(10);
+        ITmfTimestamp tstamp1 = TmfTimestamp.fromNanos(5);
+        ITmfTimestamp expectd = TmfTimestamp.fromNanos(5);
 
         ITmfTimestamp delta = tstamp0.getDelta(tstamp1);
         assertEquals("getDelta", 0, delta.compareTo(expectd));
 
         // Delta for same scale and precision (delta < 0)
-        tstamp0 = new TmfTimestamp(5);
-        tstamp1 = new TmfTimestamp(10);
-        expectd = new TmfTimestamp(-5);
+        tstamp0 = TmfTimestamp.fromSeconds(5);
+        tstamp1 = TmfTimestamp.fromSeconds(10);
+        expectd = TmfTimestamp.fromSeconds(-5);
 
         delta = tstamp0.getDelta(tstamp1);
         assertEquals("getDelta", 0, delta.compareTo(expectd));
@@ -270,9 +259,9 @@ public class TmfNanoTimestampTest {
     @Test
     public void testDelta2() {
         // Delta for different scale and same precision (delta > 0)
-        final TmfTimestamp tstamp0 = new TmfNanoTimestamp(10);
-        final TmfTimestamp tstamp1 = new TmfTimestamp(1, -8);
-        final TmfTimestamp expectd = new TmfTimestamp(0, 0);
+        final ITmfTimestamp tstamp0 = TmfTimestamp.fromNanos(10);
+        final ITmfTimestamp tstamp1 = TmfTimestamp.create(1, -8);
+        final ITmfTimestamp expectd = TmfTimestamp.create(0, 0);
 
         final ITmfTimestamp delta = tstamp0.getDelta(tstamp1);
         assertEquals("getDelta", 0, delta.compareTo(expectd));
diff --git a/tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/event/TmfSecondTimestampTest.java b/tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/event/TmfSecondTimestampTest.java
new file mode 100644 (file)
index 0000000..838b1b2
--- /dev/null
@@ -0,0 +1,232 @@
+/*******************************************************************************
+ * 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
+ *   Alexandre Montplaisir - Port to JUnit4
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.core.tests.event;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+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;
+
+/**
+ * Test suite for the {@link TmfSecondTimestamp} class.
+ */
+@SuppressWarnings("javadoc")
+public class TmfSecondTimestampTest {
+
+    // ------------------------------------------------------------------------
+    // Variables
+    // ------------------------------------------------------------------------
+
+    private final ITmfTimestamp ts0 = new TmfSecondTimestamp(0);
+    private final ITmfTimestamp ts1 = new TmfSecondTimestamp(12345);
+    private final ITmfTimestamp ts2 = new TmfSecondTimestamp(-1234);
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testDefaultConstructor() {
+        assertEquals("getValue", 0, ts0.getValue());
+        assertEquals("getscale", 0, ts0.getScale());
+    }
+
+    @Test
+    public void testFullConstructor() {
+        assertEquals("getValue", 12345, ts1.getValue());
+        assertEquals("getscale", 0, ts1.getScale());
+    }
+
+    // ------------------------------------------------------------------------
+    // equals
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testEqualsReflexivity() {
+        assertEquals("equals", ts0, ts0);
+        assertEquals("equals", ts1, ts1);
+        assertEquals("equals", ts2, ts2);
+
+        assertFalse("different", ts0.equals(ts1));
+        assertFalse("different", ts0.equals(ts2));
+
+        assertFalse("different", ts1.equals(ts0));
+        assertFalse("different", ts1.equals(ts2));
+
+        assertFalse("different", ts2.equals(ts0));
+        assertFalse("different", ts2.equals(ts1));
+    }
+
+    @Test
+    public void testEqualsNull() {
+        assertTrue("different", !ts0.equals(null));
+        assertTrue("different", !ts1.equals(null));
+        assertTrue("different", !ts2.equals(null));
+    }
+
+    @Test
+    public void testEqualsNonTimestamp() {
+        assertFalse("equals", ts0.equals(ts0.toString()));
+    }
+
+    // ------------------------------------------------------------------------
+    // toString
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testToString() {
+        DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS");
+        Date d0 = new Date(ts0.getValue() * 1000);
+        Date d1 = new Date(ts1.getValue() * 1000);
+        Date d2 = new Date(ts2.getValue() * 1000);
+        assertEquals("toString", df.format(d0) + " 000 000", ts0.toString());
+        assertEquals("toString", df.format(d1) + " 000 000", ts1.toString());
+        assertEquals("toString", df.format(d2) + " 000 000", ts2.toString());
+    }
+
+    // ------------------------------------------------------------------------
+    // hashCode
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testHashCode() {
+        final ITmfTimestamp ts0copy = TmfTimestamp.create(ts0.getValue(), ts0.getScale());
+        final ITmfTimestamp ts1copy = TmfTimestamp.create(ts1.getValue(), ts1.getScale());
+        final ITmfTimestamp ts2copy = TmfTimestamp.create(ts2.getValue(), ts2.getScale());
+
+        assertEquals("hashCode", ts0.hashCode(), ts0copy.hashCode());
+        assertEquals("hashCode", ts1.hashCode(), ts1copy.hashCode());
+        assertEquals("hashCode", ts2.hashCode(), ts2copy.hashCode());
+    }
+
+    // ------------------------------------------------------------------------
+    // normalize
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testNormalizeScale0() {
+        ITmfTimestamp ts = ts0.normalize(0, 0);
+        assertEquals("getValue", 0, ts.getValue());
+        assertEquals("getscale", 0, ts.getScale());
+
+        ts = ts0.normalize(12345, 0);
+        assertEquals("getValue", 12345, ts.getValue());
+        assertEquals("getscale", 0, ts.getScale());
+
+        ts = ts0.normalize(10, 0);
+        assertEquals("getValue", 10, ts.getValue());
+        assertEquals("getscale", 0, ts.getScale());
+
+        ts = ts0.normalize(-10, 0);
+        assertEquals("getValue", -10, ts.getValue());
+        assertEquals("getscale", 0, ts.getScale());
+    }
+
+    @Test
+    public void testNormalizeScaleNot0() {
+        ITmfTimestamp ts = ts0.normalize(0, 1);
+        assertEquals("getValue", 0, ts.getValue());
+        assertEquals("getscale", 1, ts.getScale());
+
+        ts = ts0.normalize(12345, 1);
+        assertEquals("getValue", 12345, ts.getValue());
+        assertEquals("getscale", 1, ts.getScale());
+
+        ts = ts0.normalize(10, 1);
+        assertEquals("getValue", 10, ts.getValue());
+        assertEquals("getscale", 1, ts.getScale());
+
+        ts = ts0.normalize(-10, 1);
+        assertEquals("getValue", -10, ts.getValue());
+        assertEquals("getscale", 1, ts.getScale());
+    }
+
+    // ------------------------------------------------------------------------
+    // compareTo
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testBasicCompareTo() {
+        final ITmfTimestamp tstamp1 = TmfTimestamp.fromSeconds(900);
+        final ITmfTimestamp tstamp2 = TmfTimestamp.fromSeconds(1000);
+        final ITmfTimestamp tstamp3 = TmfTimestamp.fromSeconds(1100);
+
+        assertTrue(tstamp1.compareTo(tstamp1) == 0);
+
+        assertTrue("CompareTo", tstamp1.compareTo(tstamp2) < 0);
+        assertTrue("CompareTo", tstamp1.compareTo(tstamp3) < 0);
+
+        assertTrue("CompareTo", tstamp2.compareTo(tstamp1) > 0);
+        assertTrue("CompareTo", tstamp2.compareTo(tstamp3) < 0);
+
+        assertTrue("CompareTo", tstamp3.compareTo(tstamp1) > 0);
+        assertTrue("CompareTo", tstamp3.compareTo(tstamp2) > 0);
+    }
+
+    @Test
+    public void testCompareTo() {
+        final ITmfTimestamp ts0a = TmfTimestamp.create(0, 2);
+        final ITmfTimestamp ts1a = TmfTimestamp.create(123450, -1);
+        final ITmfTimestamp ts2a = TmfTimestamp.create(-12340, -1);
+
+        assertTrue(ts1.compareTo(ts1) == 0);
+
+        assertTrue("CompareTo", ts0.compareTo(ts0a) == 0);
+        assertTrue("CompareTo", ts1.compareTo(ts1a) == 0);
+        assertTrue("CompareTo", ts2.compareTo(ts2a) == 0);
+    }
+
+    // ------------------------------------------------------------------------
+    // getDelta
+    // ------------------------------------------------------------------------
+
+    @Test
+    public void testDelta() {
+        // Delta for same scale and precision (delta > 0)
+        ITmfTimestamp tstamp0 = TmfTimestamp.fromSeconds(10);
+        ITmfTimestamp tstamp1 = TmfTimestamp.fromSeconds(5);
+        ITmfTimestamp expectd = TmfTimestamp.fromSeconds(5);
+
+        ITmfTimestamp delta = tstamp0.getDelta(tstamp1);
+        assertEquals("getDelta", 0, delta.compareTo(expectd));
+
+        // Delta for same scale and precision (delta < 0)
+        tstamp0 = TmfTimestamp.fromSeconds(5);
+        tstamp1 = TmfTimestamp.fromSeconds(10);
+        expectd = TmfTimestamp.fromSeconds(-5);
+
+        delta = tstamp0.getDelta(tstamp1);
+        assertEquals("getDelta", 0, delta.compareTo(expectd));
+    }
+
+    @Test
+    public void testDelta2() {
+        // Delta for different scale and same precision (delta > 0)
+        final ITmfTimestamp tstamp0 = TmfTimestamp.fromSeconds(10);
+        final ITmfTimestamp tstamp1 = TmfTimestamp.create(1, 1);
+        final ITmfTimestamp expectd = TmfTimestamp.create(0, 0);
+
+        final ITmfTimestamp delta = tstamp0.getDelta(tstamp1);
+        assertEquals("getDelta", 0, delta.compareTo(expectd));
+    }
+
+}
diff --git a/tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/event/TmfSimpleTimestampTest.java b/tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/event/TmfSimpleTimestampTest.java
deleted file mode 100644 (file)
index bec7720..0000000
+++ /dev/null
@@ -1,281 +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
- *   Alexandre Montplaisir - Port to JUnit4
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.core.tests.event;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfSimpleTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
-import org.junit.Test;
-
-/**
- * Test suite for the TmfSimpleTimestampTest class.
- */
-@SuppressWarnings("javadoc")
-public class TmfSimpleTimestampTest {
-
-    // ------------------------------------------------------------------------
-    // Variables
-    // ------------------------------------------------------------------------
-
-    private final ITmfTimestamp ts0 = new TmfSimpleTimestamp();
-    private final ITmfTimestamp ts1 = new TmfSimpleTimestamp(12345);
-    private final ITmfTimestamp ts2 = new TmfSimpleTimestamp(-1234);
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testDefaultConstructor() {
-        assertEquals("getValue", 0, ts0.getValue());
-        assertEquals("getscale", 0, ts0.getScale());
-    }
-
-    @Test
-    public void testFullConstructor() {
-        assertEquals("getValue", 12345, ts1.getValue());
-        assertEquals("getscale", 0, ts1.getScale());
-    }
-
-    @Test
-    public void testCopyConstructor() {
-        final ITmfTimestamp copy = new TmfSimpleTimestamp(ts1);
-
-        assertEquals("getValue", ts1.getValue(), copy.getValue());
-        assertEquals("getscale", ts1.getScale(), copy.getScale());
-
-        assertEquals("getValue", 12345, copy.getValue());
-        assertEquals("getscale", 0, copy.getScale());
-    }
-
-    @Test
-    public void testCopyBadTimestamp() {
-        try {
-            new TmfSimpleTimestamp(null);
-            fail("TmfSimpleTimestamp: null argument");
-        } catch (final NullPointerException e) {
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // equals
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testEqualsReflexivity() {
-        assertTrue("equals", ts0.equals(ts0));
-        assertTrue("equals", ts1.equals(ts1));
-        assertTrue("equals", ts2.equals(ts2));
-
-        assertTrue("equals", !ts0.equals(ts1));
-        assertTrue("equals", !ts0.equals(ts2));
-
-        assertTrue("equals", !ts1.equals(ts0));
-        assertTrue("equals", !ts1.equals(ts2));
-
-        assertTrue("equals", !ts2.equals(ts0));
-        assertTrue("equals", !ts2.equals(ts1));
-    }
-
-    @Test
-    public void testEqualsSymmetry() {
-        final ITmfTimestamp ts0copy = new TmfSimpleTimestamp(ts0);
-        assertTrue("equals", ts0.equals(ts0copy));
-        assertTrue("equals", ts0copy.equals(ts0));
-
-        final ITmfTimestamp ts1copy = new TmfSimpleTimestamp(ts1);
-        assertTrue("equals", ts1.equals(ts1copy));
-        assertTrue("equals", ts1copy.equals(ts1));
-    }
-
-    @Test
-    public void testEqualsTransivity() {
-        final ITmfTimestamp ts0copy1 = new TmfSimpleTimestamp(ts0);
-        final ITmfTimestamp ts0copy2 = new TmfSimpleTimestamp(ts0copy1);
-        assertTrue("equals", ts0.equals(ts0copy1));
-        assertTrue("equals", ts0copy1.equals(ts0copy2));
-        assertTrue("equals", ts0.equals(ts0copy2));
-
-        final ITmfTimestamp ts1copy1 = new TmfSimpleTimestamp(ts1);
-        final ITmfTimestamp ts1copy2 = new TmfSimpleTimestamp(ts1copy1);
-        assertTrue("equals", ts1.equals(ts1copy1));
-        assertTrue("equals", ts1copy1.equals(ts1copy2));
-        assertTrue("equals", ts1.equals(ts1copy2));
-    }
-
-    @Test
-    public void testEqualsNull() {
-        assertTrue("equals", !ts0.equals(null));
-        assertTrue("equals", !ts1.equals(null));
-        assertTrue("equals", !ts2.equals(null));
-    }
-
-    @Test
-    public void testEqualsNonTimestamp() {
-        assertFalse("equals", ts0.equals(ts0.toString()));
-    }
-
-    // ------------------------------------------------------------------------
-    // toString
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testToString() {
-        DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS");
-        Date d0 = new Date(ts0.getValue()*1000);
-        Date d1 = new Date(ts1.getValue()*1000);
-        Date d2 = new Date(ts2.getValue()*1000);
-        assertEquals("toString", df.format(d0) + " 000 000", ts0.toString());
-        assertEquals("toString", df.format(d1) + " 000 000", ts1.toString());
-        assertEquals("toString", df.format(d2) + " 000 000", ts2.toString());
-    }
-
-    // ------------------------------------------------------------------------
-    // hashCode
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testHashCode() {
-        final ITmfTimestamp ts0copy = new TmfTimestamp(ts0);
-        final ITmfTimestamp ts1copy = new TmfTimestamp(ts1);
-        final ITmfTimestamp ts2copy = new TmfTimestamp(ts2);
-
-        assertTrue("hashCode", ts0.hashCode() == ts0copy.hashCode());
-        assertTrue("hashCode", ts1.hashCode() == ts1copy.hashCode());
-        assertTrue("hashCode", ts2.hashCode() == ts2copy.hashCode());
-
-        assertTrue("hashCode", ts0.hashCode() != ts1.hashCode());
-    }
-
-    // ------------------------------------------------------------------------
-    // normalize
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testNormalizeScale0() {
-        ITmfTimestamp ts = ts0.normalize(0, 0);
-        assertEquals("getValue", 0, ts.getValue());
-        assertEquals("getscale", 0, ts.getScale());
-
-        ts = ts0.normalize(12345, 0);
-        assertEquals("getValue", 12345, ts.getValue());
-        assertEquals("getscale", 0, ts.getScale());
-
-        ts = ts0.normalize(10, 0);
-        assertEquals("getValue", 10, ts.getValue());
-        assertEquals("getscale", 0, ts.getScale());
-
-        ts = ts0.normalize(-10, 0);
-        assertEquals("getValue", -10, ts.getValue());
-        assertEquals("getscale", 0, ts.getScale());
-    }
-
-    @Test
-    public void testNormalizeScaleNot0() {
-        ITmfTimestamp ts = ts0.normalize(0, 1);
-        assertEquals("getValue", 0, ts.getValue());
-        assertEquals("getscale", 1, ts.getScale());
-
-        ts = ts0.normalize(12345, 1);
-        assertEquals("getValue", 12345, ts.getValue());
-        assertEquals("getscale", 1, ts.getScale());
-
-        ts = ts0.normalize(10, 1);
-        assertEquals("getValue", 10, ts.getValue());
-        assertEquals("getscale", 1, ts.getScale());
-
-        ts = ts0.normalize(-10, 1);
-        assertEquals("getValue", -10, ts.getValue());
-        assertEquals("getscale", 1, ts.getScale());
-    }
-
-    // ------------------------------------------------------------------------
-    // compareTo
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testBasicCompareTo() {
-        final ITmfTimestamp tstamp1 = new TmfSimpleTimestamp(900);
-        final ITmfTimestamp tstamp2 = new TmfSimpleTimestamp(1000);
-        final ITmfTimestamp tstamp3 = new TmfSimpleTimestamp(1100);
-
-        assertTrue(tstamp1.compareTo(tstamp1) == 0);
-
-        assertTrue("CompareTo", tstamp1.compareTo(tstamp2) < 0);
-        assertTrue("CompareTo", tstamp1.compareTo(tstamp3) < 0);
-
-        assertTrue("CompareTo", tstamp2.compareTo(tstamp1) > 0);
-        assertTrue("CompareTo", tstamp2.compareTo(tstamp3) < 0);
-
-        assertTrue("CompareTo", tstamp3.compareTo(tstamp1) > 0);
-        assertTrue("CompareTo", tstamp3.compareTo(tstamp2) > 0);
-    }
-
-    @Test
-    public void testCompareTo() {
-        final ITmfTimestamp ts0a = new TmfTimestamp(0, 2);
-        final ITmfTimestamp ts1a = new TmfTimestamp(123450, -1);
-        final ITmfTimestamp ts2a = new TmfTimestamp(-12340, -1);
-
-        assertTrue(ts1.compareTo(ts1) == 0);
-
-        assertTrue("CompareTo", ts0.compareTo(ts0a) == 0);
-        assertTrue("CompareTo", ts1.compareTo(ts1a) == 0);
-        assertTrue("CompareTo", ts2.compareTo(ts2a) == 0);
-    }
-
-    // ------------------------------------------------------------------------
-    // getDelta
-    // ------------------------------------------------------------------------
-
-    @Test
-    public void testDelta() {
-        // Delta for same scale and precision (delta > 0)
-        TmfTimestamp tstamp0 = new TmfSimpleTimestamp(10);
-        TmfTimestamp tstamp1 = new TmfSimpleTimestamp(5);
-        TmfTimestamp expectd = new TmfSimpleTimestamp(5);
-
-        ITmfTimestamp delta = tstamp0.getDelta(tstamp1);
-        assertEquals("getDelta", 0, delta.compareTo(expectd));
-
-        // Delta for same scale and precision (delta < 0)
-        tstamp0 = new TmfTimestamp(5);
-        tstamp1 = new TmfTimestamp(10);
-        expectd = new TmfTimestamp(-5);
-
-        delta = tstamp0.getDelta(tstamp1);
-        assertEquals("getDelta", 0, delta.compareTo(expectd));
-    }
-
-    @Test
-    public void testDelta2() {
-        // Delta for different scale and same precision (delta > 0)
-        final TmfTimestamp tstamp0 = new TmfSimpleTimestamp(10);
-        final TmfTimestamp tstamp1 = new TmfTimestamp(1, 1);
-        final TmfTimestamp expectd = new TmfTimestamp(0, 0);
-
-        final ITmfTimestamp delta = tstamp0.getDelta(tstamp1);
-        assertEquals("getDelta", 0, delta.compareTo(expectd));
-    }
-
-}
index 32bea617d352ac75a25bccf2dc53779ed783e302..b5daba3c42e6c6038fb22697584f0b39019a13b4 100644 (file)
@@ -35,8 +35,8 @@ public class TmfTimeRangeTest {
 
     @Test
     public void testConstructor() {
-        final ITmfTimestamp ts1 = new TmfTimestamp(12345);
-        final ITmfTimestamp ts2 = new TmfTimestamp(12350);
+        final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
+        final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
         final TmfTimeRange range = new TmfTimeRange(ts1, ts2);
 
         assertEquals("startTime", ts1, range.getStartTime());
@@ -45,7 +45,7 @@ public class TmfTimeRangeTest {
 
     @Test
     public void testOpenRange1() {
-        final ITmfTimestamp ts2 = new TmfTimestamp(12350);
+        final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
         final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, ts2);
 
         assertEquals("startTime", TmfTimestamp.BIG_BANG, range.getStartTime());
@@ -54,7 +54,7 @@ public class TmfTimeRangeTest {
 
     @Test
     public void testOpenRange2() {
-        final ITmfTimestamp ts1 = new TmfTimestamp(12345);
+        final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
         final TmfTimeRange range = new TmfTimeRange(ts1, TmfTimestamp.BIG_CRUNCH);
 
         assertEquals("startTime", ts1, range.getStartTime());
@@ -75,8 +75,8 @@ public class TmfTimeRangeTest {
 
     @Test
     public void testHashCode() {
-        final ITmfTimestamp ts1 = new TmfTimestamp(12345);
-        final ITmfTimestamp ts2 = new TmfTimestamp(12350);
+        final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
+        final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
         final TmfTimeRange range1 = new TmfTimeRange(ts1, ts2);
         final TmfTimeRange range1b =new TmfTimeRange(ts1, ts2);
         final TmfTimeRange range2 = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
@@ -94,8 +94,8 @@ public class TmfTimeRangeTest {
 
     @Test
     public void testEqualsReflexivity() {
-        final ITmfTimestamp ts1 = new TmfTimestamp(12345);
-        final ITmfTimestamp ts2 = new TmfTimestamp(12350);
+        final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
+        final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
         final TmfTimeRange range1 = new TmfTimeRange(ts1, ts2);
         final TmfTimeRange range2 = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
 
@@ -108,8 +108,8 @@ public class TmfTimeRangeTest {
 
     @Test
     public void testEqualsSymmetry() {
-        final ITmfTimestamp ts1 = new TmfTimestamp(12345);
-        final ITmfTimestamp ts2 = new TmfTimestamp(12350);
+        final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
+        final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
         final TmfTimeRange range1a = new TmfTimeRange(ts1, ts2);
         final TmfTimeRange range1b = new TmfTimeRange(ts1, ts2);
 
@@ -125,8 +125,8 @@ public class TmfTimeRangeTest {
 
     @Test
     public void testEqualsTransivity() {
-        final ITmfTimestamp ts1 = new TmfTimestamp(12345);
-        final ITmfTimestamp ts2 = new TmfTimestamp(12350);
+        final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
+        final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
         final TmfTimeRange range1a = new TmfTimeRange(ts1, ts2);
         final TmfTimeRange range1b = new TmfTimeRange(ts1, ts2);
         final TmfTimeRange range1c = new TmfTimeRange(ts1, ts2);
@@ -138,8 +138,8 @@ public class TmfTimeRangeTest {
 
     @Test
     public void testEqualsNull() {
-        final ITmfTimestamp ts1 = new TmfTimestamp(12345);
-        final ITmfTimestamp ts2 = new TmfTimestamp(12350);
+        final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
+        final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
         final TmfTimeRange range1 = new TmfTimeRange(ts1, ts2);
 
         assertTrue("equals", !range1.equals(null));
@@ -147,8 +147,8 @@ public class TmfTimeRangeTest {
 
     @Test
     public void testEqualsBadType() {
-        final ITmfTimestamp ts1 = new TmfTimestamp(12345);
-        final ITmfTimestamp ts2 = new TmfTimestamp(12350);
+        final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
+        final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
         final TmfTimeRange range1 = new TmfTimeRange(ts1, ts2);
 
         assertTrue("equals", !range1.equals(ts1));
@@ -156,9 +156,9 @@ public class TmfTimeRangeTest {
 
     @Test
     public void testEqualStartTime() {
-        final ITmfTimestamp ts1 = new TmfTimestamp(12345);
-        final ITmfTimestamp ts2 = new TmfTimestamp(12350);
-        final ITmfTimestamp ts3 = new TmfTimestamp(12355);
+        final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
+        final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
+        final ITmfTimestamp ts3 = TmfTimestamp.fromSeconds(12355);
 
         final TmfTimeRange range1 = new TmfTimeRange(ts1, ts3);
         final TmfTimeRange range2 = new TmfTimeRange(ts2, ts3);
@@ -170,9 +170,9 @@ public class TmfTimeRangeTest {
 
     @Test
     public void testEqualsEndTime() {
-        final ITmfTimestamp ts1 = new TmfTimestamp(12345);
-        final ITmfTimestamp ts2 = new TmfTimestamp(12350);
-        final ITmfTimestamp ts3 = new TmfTimestamp(12355);
+        final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
+        final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
+        final ITmfTimestamp ts3 = TmfTimestamp.fromSeconds(12355);
 
         final TmfTimeRange range1 = new TmfTimeRange(ts1, ts2);
         final TmfTimeRange range2 = new TmfTimeRange(ts1, ts3);
@@ -188,8 +188,8 @@ public class TmfTimeRangeTest {
 
     @Test
     public void testToString() {
-        final ITmfTimestamp ts1 = new TmfTimestamp(12345);
-        final ITmfTimestamp ts2 = new TmfTimestamp(12350);
+        final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
+        final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
         final TmfTimeRange range = new TmfTimeRange(ts1, ts2);
 
         final String expected = "TmfTimeRange [fStartTime=" + ts1 + ", fEndTime=" + ts2 + "]";
@@ -202,28 +202,28 @@ public class TmfTimeRangeTest {
 
     @Test
     public void testContainsTimestamp() {
-        final ITmfTimestamp ts1 = new TmfTimestamp(12345);
-        final ITmfTimestamp ts2 = new TmfTimestamp(12350);
+        final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
+        final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
         final TmfTimeRange range = new TmfTimeRange(ts1, ts2);
 
-        assertTrue("contains (lower bound)", range.contains(new TmfTimestamp(12345)));
-        assertTrue("contains (higher bound)", range.contains(new TmfTimestamp(12350)));
-        assertTrue("contains (within bounds)", range.contains(new TmfTimestamp(12346)));
+        assertTrue("contains (lower bound)", range.contains(TmfTimestamp.fromSeconds(12345)));
+        assertTrue("contains (higher bound)", range.contains(TmfTimestamp.fromSeconds(12350)));
+        assertTrue("contains (within bounds)", range.contains(TmfTimestamp.fromSeconds(12346)));
 
-        assertFalse("contains (low value)", range.contains(new TmfTimestamp(12340)));
-        assertFalse("contains (high value)", range.contains(new TmfTimestamp(12351)));
+        assertFalse("contains (low value)", range.contains(TmfTimestamp.fromSeconds(12340)));
+        assertFalse("contains (high value)", range.contains(TmfTimestamp.fromSeconds(12351)));
     }
 
     @Test
     public void testContainsRange() {
-        final ITmfTimestamp ts1 = new TmfTimestamp(10);
-        final ITmfTimestamp ts2 = new TmfTimestamp(20);
-        final ITmfTimestamp ts3 = new TmfTimestamp(30);
-        final ITmfTimestamp ts4 = new TmfTimestamp(40);
-        final ITmfTimestamp ts5 = new TmfTimestamp(50);
-        final ITmfTimestamp ts6 = new TmfTimestamp(60);
-        final ITmfTimestamp ts7 = new TmfTimestamp(70);
-        final ITmfTimestamp ts8 = new TmfTimestamp(80);
+        final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(10);
+        final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(20);
+        final ITmfTimestamp ts3 = TmfTimestamp.fromSeconds(30);
+        final ITmfTimestamp ts4 = TmfTimestamp.fromSeconds(40);
+        final ITmfTimestamp ts5 = TmfTimestamp.fromSeconds(50);
+        final ITmfTimestamp ts6 = TmfTimestamp.fromSeconds(60);
+        final ITmfTimestamp ts7 = TmfTimestamp.fromSeconds(70);
+        final ITmfTimestamp ts8 = TmfTimestamp.fromSeconds(80);
 
         // Reference range
         final TmfTimeRange range0 = new TmfTimeRange(ts3, ts6);
@@ -271,36 +271,36 @@ public class TmfTimeRangeTest {
     @Test
     public void testGetIntersection() {
 
-        final ITmfTimestamp ts1a = new TmfTimestamp(1000);
-        final ITmfTimestamp ts1b = new TmfTimestamp(2000);
+        final ITmfTimestamp ts1a = TmfTimestamp.fromSeconds(1000);
+        final ITmfTimestamp ts1b = TmfTimestamp.fromSeconds(2000);
         final TmfTimeRange range1 = new TmfTimeRange(ts1a, ts1b);
 
-        final ITmfTimestamp ts2a = new TmfTimestamp(2000);
-        final ITmfTimestamp ts2b = new TmfTimestamp(3000);
+        final ITmfTimestamp ts2a = TmfTimestamp.fromSeconds(2000);
+        final ITmfTimestamp ts2b = TmfTimestamp.fromSeconds(3000);
         final TmfTimeRange range2 = new TmfTimeRange(ts2a, ts2b);
 
-        final ITmfTimestamp ts3a = new TmfTimestamp(3000);
-        final ITmfTimestamp ts3b = new TmfTimestamp(4000);
+        final ITmfTimestamp ts3a = TmfTimestamp.fromSeconds(3000);
+        final ITmfTimestamp ts3b = TmfTimestamp.fromSeconds(4000);
         final TmfTimeRange range3 = new TmfTimeRange(ts3a, ts3b);
 
-        final ITmfTimestamp ts4a = new TmfTimestamp(1500);
-        final ITmfTimestamp ts4b = new TmfTimestamp(2500);
+        final ITmfTimestamp ts4a = TmfTimestamp.fromSeconds(1500);
+        final ITmfTimestamp ts4b = TmfTimestamp.fromSeconds(2500);
         final TmfTimeRange range4 = new TmfTimeRange(ts4a, ts4b);
 
-        final ITmfTimestamp ts5a = new TmfTimestamp(1500);
-        final ITmfTimestamp ts5b = new TmfTimestamp(2000);
+        final ITmfTimestamp ts5a = TmfTimestamp.fromSeconds(1500);
+        final ITmfTimestamp ts5b = TmfTimestamp.fromSeconds(2000);
         final TmfTimeRange range5 = new TmfTimeRange(ts5a, ts5b);
 
-        final ITmfTimestamp ts6a = new TmfTimestamp(2000);
-        final ITmfTimestamp ts6b = new TmfTimestamp(2500);
+        final ITmfTimestamp ts6a = TmfTimestamp.fromSeconds(2000);
+        final ITmfTimestamp ts6b = TmfTimestamp.fromSeconds(2500);
         final TmfTimeRange range6 = new TmfTimeRange(ts6a, ts6b);
 
-        final ITmfTimestamp ts7a = new TmfTimestamp(1500);
-        final ITmfTimestamp ts7b = new TmfTimestamp(3500);
+        final ITmfTimestamp ts7a = TmfTimestamp.fromSeconds(1500);
+        final ITmfTimestamp ts7b = TmfTimestamp.fromSeconds(3500);
         final TmfTimeRange range7 = new TmfTimeRange(ts7a, ts7b);
 
-        final ITmfTimestamp ts8a = new TmfTimestamp(2250);
-        final ITmfTimestamp ts8b = new TmfTimestamp(2750);
+        final ITmfTimestamp ts8a = TmfTimestamp.fromSeconds(2250);
+        final ITmfTimestamp ts8b = TmfTimestamp.fromSeconds(2750);
         final TmfTimeRange range8 = new TmfTimeRange(ts8a, ts8b);
 
         assertEquals("getIntersection (below - not contiguous)", null, range1.getIntersection(range3));
index 86223ee8c30f7a673e1c757d4b7472be6239b3f1..67f2f3039c999232b15cb16a2efead4a8b19ce0e 100644 (file)
@@ -71,8 +71,8 @@ public class TmfTimestampDeltaTest {
 
     @Test
     public void testCopyConstructor() {
-        final ITmfTimestamp ts = new TmfTimestamp(12345, 2);
-        final ITmfTimestamp copy = new TmfTimestamp(ts);
+        final ITmfTimestamp ts = TmfTimestamp.create(12345, 2);
+        final ITmfTimestamp copy = TmfTimestamp.create(12345, 2);
 
         assertEquals("getValue", ts.getValue(), copy.getValue());
         assertEquals("getscale", ts.getScale(), copy.getScale());
@@ -81,11 +81,6 @@ public class TmfTimestampDeltaTest {
         assertEquals("getscale", 2, copy.getScale());
     }
 
-    @Test(expected=IllegalArgumentException.class)
-    public void testCopyNullConstructor() {
-        new TmfTimestamp((TmfTimestamp) null);
-    }
-
     // ------------------------------------------------------------------------
     // normalize
     // ------------------------------------------------------------------------
index 3212b35fd89e6f98aa22b23a94a196f6c17296c6..1a0c1333ee38cc40d33989e6c069476c4932be8c 100644 (file)
@@ -38,18 +38,18 @@ public class TmfTimestampTest {
     // Variables
     // ------------------------------------------------------------------------
 
-    private final ITmfTimestamp ts0 = new TmfTimestamp();
-    private final ITmfTimestamp ts1 = new TmfTimestamp(12345, 0);
-    private final ITmfTimestamp ts2 = new TmfTimestamp(12345, -1);
-    private final ITmfTimestamp ts3 = new TmfTimestamp(12345, 2);
-    private final ITmfTimestamp ts4 = new TmfTimestamp(12345, -3);
-    private final ITmfTimestamp ts5 = new TmfTimestamp(12345, -6);
-    private final ITmfTimestamp ts6 = new TmfTimestamp(12345, -9);
-    private final ITmfTimestamp ts7 = new TmfTimestamp(-12345, -3);
-    private final ITmfTimestamp ts8 = new TmfTimestamp(-12345, -6);
-    private final ITmfTimestamp ts9 = new TmfTimestamp(-12345, -9);
-    private final ITmfTimestamp ts10 = new TmfTimestamp(Long.MAX_VALUE / 100, -6);
-    private final ITmfTimestamp ts11 = new TmfTimestamp(Long.MIN_VALUE / 100, -6);
+    private final ITmfTimestamp ts0 = TmfTimestamp.create(0, ITmfTimestamp.SECOND_SCALE);
+    private final ITmfTimestamp ts1 = TmfTimestamp.create(12345, 0);
+    private final ITmfTimestamp ts2 = TmfTimestamp.create(12345, -1);
+    private final ITmfTimestamp ts3 = TmfTimestamp.create(12345, 2);
+    private final ITmfTimestamp ts4 = TmfTimestamp.create(12345, -3);
+    private final ITmfTimestamp ts5 = TmfTimestamp.create(12345, -6);
+    private final ITmfTimestamp ts6 = TmfTimestamp.create(12345, -9);
+    private final ITmfTimestamp ts7 = TmfTimestamp.create(-12345, -3);
+    private final ITmfTimestamp ts8 = TmfTimestamp.create(-12345, -6);
+    private final ITmfTimestamp ts9 = TmfTimestamp.create(-12345, -9);
+    private final ITmfTimestamp ts10 = TmfTimestamp.create(Long.MAX_VALUE / 100, -6);
+    private final ITmfTimestamp ts11 = TmfTimestamp.create(Long.MIN_VALUE / 100, -6);
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -81,8 +81,8 @@ public class TmfTimestampTest {
 
     @Test
     public void testCopyConstructor() {
-        final ITmfTimestamp ts = new TmfTimestamp(12345, 2);
-        final ITmfTimestamp copy = new TmfTimestamp(ts);
+        final ITmfTimestamp ts = TmfTimestamp.create(12345, 2);
+        final ITmfTimestamp copy = TmfTimestamp.create(ts.getValue(), ts.getScale());
 
         assertEquals("getValue", ts.getValue(), copy.getValue());
         assertEquals("getscale", ts.getScale(), copy.getScale());
@@ -91,28 +91,23 @@ public class TmfTimestampTest {
         assertEquals("getscale", 2, copy.getScale());
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testCopyNullConstructor() {
-        new TmfTimestamp((TmfTimestamp) null);
-    }
-
     @Test
     public void testCopyConstructorBigBang() {
-        final ITmfTimestamp ts = new TmfTimestamp(TmfTimestamp.BIG_BANG);
+        final ITmfTimestamp ts = TmfTimestamp.create(TmfTimestamp.BIG_BANG.getValue(), TmfTimestamp.BIG_BANG.getScale());
         assertEquals("getValue", TmfTimestamp.BIG_BANG.getValue(), ts.getValue());
         assertEquals("getscale", TmfTimestamp.BIG_BANG.getScale(), ts.getScale());
     }
 
     @Test
     public void testCopyConstructorBigCrunch() {
-        final ITmfTimestamp ts = new TmfTimestamp(TmfTimestamp.BIG_CRUNCH);
+        final ITmfTimestamp ts = TmfTimestamp.create(TmfTimestamp.BIG_CRUNCH.getValue(), TmfTimestamp.BIG_CRUNCH.getScale());
         assertEquals("getValue", TmfTimestamp.BIG_CRUNCH.getValue(), ts.getValue());
         assertEquals("getscale", TmfTimestamp.BIG_CRUNCH.getScale(), ts.getScale());
     }
 
     @Test
     public void testCopyConstructorZero() {
-        final ITmfTimestamp ts = new TmfTimestamp(TmfTimestamp.ZERO);
+        final ITmfTimestamp ts = TmfTimestamp.create(TmfTimestamp.ZERO.getValue(), TmfTimestamp.ZERO.getScale());
         assertEquals("getValue", TmfTimestamp.ZERO.getValue(), ts.getValue());
         assertEquals("getscale", TmfTimestamp.ZERO.getScale(), ts.getScale());
     }
@@ -123,13 +118,13 @@ public class TmfTimestampTest {
 
     @Test
     public void testHashCode() {
-        final ITmfTimestamp ts0copy = new TmfTimestamp(ts0);
-        final ITmfTimestamp ts1copy = new TmfTimestamp(ts1);
-        final ITmfTimestamp ts2copy = new TmfTimestamp(ts2);
+        final ITmfTimestamp ts0copy = TmfTimestamp.create(ts0.getValue(), ts0.getScale());
+        final ITmfTimestamp ts1copy = TmfTimestamp.create(ts1.getValue(), ts1.getScale());
+        final ITmfTimestamp ts2copy = TmfTimestamp.create(ts2.getValue(), ts2.getScale());
 
-        assertTrue("hashCode", ts0.hashCode() == ts0copy.hashCode());
-        assertTrue("hashCode", ts1.hashCode() == ts1copy.hashCode());
-        assertTrue("hashCode", ts2.hashCode() == ts2copy.hashCode());
+        assertEquals("hashCode", ts0.hashCode(), ts0copy.hashCode());
+        assertEquals("hashCode", ts1.hashCode(), ts1copy.hashCode());
+        assertEquals("hashCode", ts2.hashCode(), ts2copy.hashCode());
 
         assertTrue("hashCode", ts0.hashCode() != ts1.hashCode());
     }
@@ -140,44 +135,44 @@ public class TmfTimestampTest {
 
     @Test
     public void testEqualsReflexivity() {
-        assertTrue("equals", ts0.equals(ts0));
-        assertTrue("equals", ts1.equals(ts1));
+        assertEquals("equals", ts0, ts0);
+        assertEquals("equals", ts1, ts1);
 
-        assertTrue("equals", !ts0.equals(ts1));
-        assertTrue("equals", !ts1.equals(ts0));
+        assertFalse("Different", ts0.equals(ts1));
+        assertFalse("Different", ts1.equals(ts0));
     }
 
     @Test
     public void testEqualsSymmetry() {
-        final ITmfTimestamp ts0copy = new TmfTimestamp(ts0);
-        assertTrue("equals", ts0.equals(ts0copy));
-        assertTrue("equals", ts0copy.equals(ts0));
+        final ITmfTimestamp ts0copy = TmfTimestamp.create(ts0.getValue(), ts0.getScale());
+        assertEquals("equals", ts0, ts0copy);
+        assertEquals("equals", ts0copy, ts0);
 
-        final ITmfTimestamp ts1copy = new TmfTimestamp(ts1);
-        assertTrue("equals", ts1.equals(ts1copy));
-        assertTrue("equals", ts1copy.equals(ts1));
+        final ITmfTimestamp ts1copy = TmfTimestamp.create(ts1.getValue(), ts1.getScale());
+        assertEquals("equals", ts1, ts1copy);
+        assertEquals("equals", ts1copy, ts1);
 
-        final ITmfTimestamp ts2copy = new TmfTimestamp(ts2);
-        assertTrue("equals", ts2.equals(ts2copy));
-        assertTrue("equals", ts2copy.equals(ts2));
+        final ITmfTimestamp ts2copy = TmfTimestamp.create(ts2.getValue(), ts2.getScale());
+        assertEquals("equals", ts2, ts2copy);
+        assertEquals("equals", ts2copy, ts2);
     }
 
     @Test
     public void testEqualsTransivity() {
-        final ITmfTimestamp ts0copy1 = new TmfTimestamp(ts0);
-        final ITmfTimestamp ts0copy2 = new TmfTimestamp(ts0copy1);
+        final ITmfTimestamp ts0copy1 = TmfTimestamp.create(ts0.getValue(), ts0.getScale());
+        final ITmfTimestamp ts0copy2 = TmfTimestamp.create(ts0copy1.getValue(), ts0copy1.getScale());
         assertTrue("equals", ts0.equals(ts0copy1));
         assertTrue("equals", ts0copy1.equals(ts0copy2));
         assertTrue("equals", ts0.equals(ts0copy2));
 
-        final ITmfTimestamp ts1copy1 = new TmfTimestamp(ts1);
-        final ITmfTimestamp ts1copy2 = new TmfTimestamp(ts1copy1);
+        final ITmfTimestamp ts1copy1 = TmfTimestamp.create(ts1.getValue(), ts1.getScale());
+        final ITmfTimestamp ts1copy2 = TmfTimestamp.create(ts1copy1.getValue(), ts1copy1.getScale());
         assertTrue("equals", ts1.equals(ts1copy1));
         assertTrue("equals", ts1copy1.equals(ts1copy2));
         assertTrue("equals", ts1.equals(ts1copy2));
 
-        final ITmfTimestamp ts2copy1 = new TmfTimestamp(ts2);
-        final ITmfTimestamp ts2copy2 = new TmfTimestamp(ts2copy1);
+        final ITmfTimestamp ts2copy1 = TmfTimestamp.create(ts2.getValue(), ts2.getScale());
+        final ITmfTimestamp ts2copy2 = TmfTimestamp.create(ts2copy1.getValue(), ts2copy1.getScale());
         assertTrue("equals", ts2.equals(ts2copy1));
         assertTrue("equals", ts2copy1.equals(ts2copy2));
         assertTrue("equals", ts2.equals(ts2copy2));
@@ -262,7 +257,7 @@ public class TmfTimestampTest {
 
     @Test
     public void testNormalizeOffsetLowerLimits() {
-        final ITmfTimestamp ref = new TmfTimestamp(Long.MIN_VALUE + 5, 0);
+        final ITmfTimestamp ref = TmfTimestamp.create(Long.MIN_VALUE + 5, 0);
 
         ITmfTimestamp ts = ref.normalize(-4, 0);
         assertEquals("getValue", Long.MIN_VALUE + 1, ts.getValue());
@@ -279,7 +274,7 @@ public class TmfTimestampTest {
 
     @Test
     public void testNormalizeOffsetUpperLimits() {
-        final ITmfTimestamp ref = new TmfTimestamp(Long.MAX_VALUE - 5, 0);
+        final ITmfTimestamp ref = TmfTimestamp.create(Long.MAX_VALUE - 5, 0);
 
         ITmfTimestamp ts = ref.normalize(4, 0);
         assertEquals("getValue", Long.MAX_VALUE - 1, ts.getValue());
@@ -385,10 +380,10 @@ public class TmfTimestampTest {
 
     @Test
     public void testBasicCompareTo() {
-        final ITmfTimestamp t1 = new TmfTimestamp(900, 0);
-        final ITmfTimestamp t2 = new TmfTimestamp(1000, 0);
-        final ITmfTimestamp t3 = new TmfTimestamp(1100, 0);
-        final ITmfTimestamp t4 = new TmfTimestamp(1000, 0);
+        final ITmfTimestamp t1 = TmfTimestamp.create(900, 0);
+        final ITmfTimestamp t2 = TmfTimestamp.create(1000, 0);
+        final ITmfTimestamp t3 = TmfTimestamp.create(1100, 0);
+        final ITmfTimestamp t4 = TmfTimestamp.create(1000, 0);
 
         assertTrue(t1.compareTo(t1) == 0);
 
@@ -407,10 +402,10 @@ public class TmfTimestampTest {
 
     @Test
     public void testCompareToCornerCases1() {
-        final ITmfTimestamp ts0a = new TmfTimestamp(ts0);
-        final ITmfTimestamp ts0b = new TmfTimestamp(ts0.getValue(), ts0.getScale() + 1);
-        final ITmfTimestamp ts0c = new TmfTimestamp(ts0.getValue() + 1, ts0.getScale());
-        final ITmfTimestamp ts0d = new TmfTimestamp(ts0.getValue() + 1, ts0.getScale() + 1);
+        final ITmfTimestamp ts0a = TmfTimestamp.create(ts0.getValue(), ts0.getScale());
+        final ITmfTimestamp ts0b = TmfTimestamp.create(ts0.getValue(), ts0.getScale() + 1);
+        final ITmfTimestamp ts0c = TmfTimestamp.create(ts0.getValue() + 1, ts0.getScale());
+        final ITmfTimestamp ts0d = TmfTimestamp.create(ts0.getValue() + 1, ts0.getScale() + 1);
 
         assertTrue("compareTo", ts0.compareTo(ts0) == 0);
         assertTrue("compareTo", ts0.compareTo(ts0a) == 0);
@@ -421,9 +416,9 @@ public class TmfTimestampTest {
 
     @Test
     public void testCompareToCornerCases2() {
-        final ITmfTimestamp ts0a = new TmfTimestamp(Long.MAX_VALUE, Integer.MAX_VALUE - 1);
-        final ITmfTimestamp ts0b = new TmfTimestamp(0, Integer.MAX_VALUE);
-        final ITmfTimestamp ts0c = new TmfTimestamp(Long.MAX_VALUE, Integer.MAX_VALUE);
+        final ITmfTimestamp ts0a = TmfTimestamp.create(Long.MAX_VALUE, Integer.MAX_VALUE - 1);
+        final ITmfTimestamp ts0b = TmfTimestamp.create(0, Integer.MAX_VALUE);
+        final ITmfTimestamp ts0c = TmfTimestamp.create(Long.MAX_VALUE, Integer.MAX_VALUE);
 
         assertEquals("compareTo", 1, ts0a.compareTo(ts0b));
         assertEquals("compareTo", -1, ts0a.compareTo(ts0c));
@@ -437,9 +432,9 @@ public class TmfTimestampTest {
 
     @Test
     public void testCompareToCornerCases3() {
-        final ITmfTimestamp ts0a = new TmfTimestamp(Long.MIN_VALUE, Integer.MAX_VALUE - 1);
-        final ITmfTimestamp ts0b = new TmfTimestamp(0, Integer.MAX_VALUE);
-        final ITmfTimestamp ts0c = new TmfTimestamp(Long.MIN_VALUE, Integer.MAX_VALUE);
+        final ITmfTimestamp ts0a = TmfTimestamp.create(Long.MIN_VALUE, Integer.MAX_VALUE - 1);
+        final ITmfTimestamp ts0b = TmfTimestamp.create(0, Integer.MAX_VALUE);
+        final ITmfTimestamp ts0c = TmfTimestamp.create(Long.MIN_VALUE, Integer.MAX_VALUE);
 
         assertEquals("compareTo", -1, ts0a.compareTo(ts0b));
         assertEquals("compareTo", 1, ts0a.compareTo(ts0c));
@@ -458,10 +453,10 @@ public class TmfTimestampTest {
 
     @Test
     public void testCompareToSameScale() {
-        final ITmfTimestamp t1 = new TmfTimestamp(900, 0);
-        final ITmfTimestamp t2 = new TmfTimestamp(1000, 0);
-        final ITmfTimestamp t3 = new TmfTimestamp(1100, 0);
-        final ITmfTimestamp t4 = new TmfTimestamp(1000, 0);
+        final ITmfTimestamp t1 = TmfTimestamp.create(900, 0);
+        final ITmfTimestamp t2 = TmfTimestamp.create(1000, 0);
+        final ITmfTimestamp t3 = TmfTimestamp.create(1100, 0);
+        final ITmfTimestamp t4 = TmfTimestamp.create(1000, 0);
 
         assertEquals(0, t1.compareTo(t1));
 
@@ -480,10 +475,10 @@ public class TmfTimestampTest {
 
     @Test
     public void testCompareToDifferentScale() {
-        final ITmfTimestamp t1 = new TmfTimestamp(9000, -1);
-        final ITmfTimestamp t2 = new TmfTimestamp(1000, 0);
-        final ITmfTimestamp t3 = new TmfTimestamp(110, 1);
-        final ITmfTimestamp t4 = new TmfTimestamp(1, 3);
+        final ITmfTimestamp t1 = TmfTimestamp.create(9000, -1);
+        final ITmfTimestamp t2 = TmfTimestamp.create(1000, 0);
+        final ITmfTimestamp t3 = TmfTimestamp.create(110, 1);
+        final ITmfTimestamp t4 = TmfTimestamp.create(1, 3);
 
         assertTrue("CompareTo", t1.compareTo(t1) == 0);
 
@@ -502,10 +497,10 @@ public class TmfTimestampTest {
 
     @Test
     public void testCompareToLargeScale1() {
-        final ITmfTimestamp t1 = new TmfTimestamp(-1, 100);
-        final ITmfTimestamp t2 = new TmfTimestamp(-1000, -100);
-        final ITmfTimestamp t3 = new TmfTimestamp(1, 100);
-        final ITmfTimestamp t4 = new TmfTimestamp(1000, -100);
+        final ITmfTimestamp t1 = TmfTimestamp.create(-1, 100);
+        final ITmfTimestamp t2 = TmfTimestamp.create(-1000, -100);
+        final ITmfTimestamp t3 = TmfTimestamp.create(1, 100);
+        final ITmfTimestamp t4 = TmfTimestamp.create(1000, -100);
 
         assertEquals("CompareTo", -1, t1.compareTo(t2));
         assertTrue("CompareTo", t1.compareTo(t3) < 0);
@@ -526,8 +521,8 @@ public class TmfTimestampTest {
 
     @Test
     public void testCompareToLargeScale2() {
-        final ITmfTimestamp ts0a = new TmfTimestamp(0, Integer.MAX_VALUE);
-        final ITmfTimestamp ts0b = new TmfTimestamp(1, Integer.MAX_VALUE);
+        final ITmfTimestamp ts0a = TmfTimestamp.create(0, Integer.MAX_VALUE);
+        final ITmfTimestamp ts0b = TmfTimestamp.create(1, Integer.MAX_VALUE);
 
         assertEquals("CompareTo", 0, ts0a.compareTo(ts0));
         assertEquals("CompareTo", 0, ts0.compareTo(ts0a));
@@ -543,57 +538,57 @@ public class TmfTimestampTest {
     @Test
     public void testDelta() {
         // Delta for same scale and precision (delta > 0)
-        ITmfTimestamp t0 = new TmfTimestamp(10, 9);
-        ITmfTimestamp t1 = new TmfTimestamp(5, 9);
-        ITmfTimestamp exp = new TmfTimestamp(5, 9);
+        ITmfTimestamp t0 = TmfTimestamp.create(10, 9);
+        ITmfTimestamp t1 = TmfTimestamp.create(5, 9);
+        ITmfTimestamp exp = TmfTimestamp.create(5, 9);
 
         ITmfTimestamp delta = t0.getDelta(t1);
         assertEquals("getDelta", 0, delta.compareTo(exp));
 
         // Delta for same scale and precision (delta < 0)
-        t0 = new TmfTimestamp(5, 9);
-        t1 = new TmfTimestamp(10, 9);
-        exp = new TmfTimestamp(-5, 9);
+        t0 = TmfTimestamp.create(5, 9);
+        t1 = TmfTimestamp.create(10, 9);
+        exp = TmfTimestamp.create(-5, 9);
 
         delta = t0.getDelta(t1);
         assertEquals("getDelta", 0, delta.compareTo(exp));
 
         // Delta for different scale and same precision (delta > 0)
-        t0 = new TmfTimestamp(5, 9);
-        t1 = new TmfTimestamp(10, 8);
-        exp = new TmfTimestamp(4, 9);
+        t0 = TmfTimestamp.create(5, 9);
+        t1 = TmfTimestamp.create(10, 8);
+        exp = TmfTimestamp.create(4, 9);
 
         delta = t0.getDelta(t1);
         assertEquals("getDelta", 0, delta.compareTo(exp));
 
         // Delta for different scale and same precision (delta > 0)
-        t0 = new TmfTimestamp(5, 9);
-        t1 = new TmfTimestamp(10, 7);
-        exp = new TmfTimestamp(5, 9);
+        t0 = TmfTimestamp.create(5, 9);
+        t1 = TmfTimestamp.create(10, 7);
+        exp = TmfTimestamp.create(5, 9);
 
         delta = t0.getDelta(t1);
         assertEquals("getDelta", 0, delta.compareTo(exp));
 
         // Delta for different scale and same precision
-        t0 = new TmfTimestamp(10, 9);
-        t1 = new TmfTimestamp(5, 8);
-        exp = new TmfTimestamp(10, 9);
+        t0 = TmfTimestamp.create(10, 9);
+        t1 = TmfTimestamp.create(5, 8);
+        exp = TmfTimestamp.create(10, 9);
 
         delta = t0.getDelta(t1);
         assertEquals("getDelta", 0, delta.compareTo(exp));
 
         // Delta for same scale
-        t0 = new TmfTimestamp(10, 9);
-        t1 = new TmfTimestamp(5, 9);
-        exp = new TmfTimestamp(5, 9);
+        t0 = TmfTimestamp.create(10, 9);
+        t1 = TmfTimestamp.create(5, 9);
+        exp = TmfTimestamp.create(5, 9);
 
         delta = t0.getDelta(t1);
         assertEquals("getDelta", 0, delta.compareTo(exp));
 
         // Delta for different scale
-        t0 = new TmfTimestamp(5, 9);
-        t1 = new TmfTimestamp(10, 8);
-        exp = new TmfTimestamp(4, 9);
+        t0 = TmfTimestamp.create(5, 9);
+        t1 = TmfTimestamp.create(10, 8);
+        exp = TmfTimestamp.create(4, 9);
         delta = t0.getDelta(t1);
         assertEquals("getDelta", 0, delta.compareTo(exp));
     }
index b7ebc41a4a7b9f2089e23e99436572e110c0fc2f..03a10620c54786f38a9e8c7f24259487bd1bb20a 100644 (file)
@@ -30,7 +30,7 @@ import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
 import org.eclipse.tracecompass.tmf.core.event.collapse.ITmfCollapsibleEvent;
 import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
 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.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.junit.After;
@@ -159,7 +159,7 @@ public class TmfCollapseFilterTest {
 
         @Override
         public ITmfTimestamp getTimestamp() {
-            return new TmfNanoTimestamp(100);
+            return TmfTimestamp.fromNanos(100);
         }
 
         @Override
index 0e9193b490238049c4e9bb593764a7f51b7dcc61..b0cdc9202865b03b6781c80fa3cc9815776d0a07 100644 (file)
@@ -30,7 +30,7 @@ import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterEqualsNode;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterMatchesNode;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterOrNode;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterTraceTypeNode;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -47,7 +47,7 @@ public class TmfFilterAndNodeTest extends TmfFilterTreeNodeTestBase {
     // ------------------------------------------------------------------------
 
     private ITmfEventField fContent = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, null);
-    private TmfEvent fEvent = new TmfEvent(TRACE, 0, new TmfNanoTimestamp(1), EVENT_TYPE, fContent);
+    private TmfEvent fEvent = new TmfEvent(TRACE, 0, TmfTimestamp.fromNanos(1), EVENT_TYPE, fContent);
     private TmfFilterAndNode fFilter;
 
     // ------------------------------------------------------------------------
index 670202a9765f1047ddc75dd0b0f614e620147351..fc109f7533cb9a4e06c75cc1ba60cdac7f70b0d9 100644 (file)
@@ -24,7 +24,7 @@ import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
 import org.eclipse.tracecompass.tmf.core.event.aspect.TmfContentFieldAspect;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterCompareNode;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterCompareNode.Type;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -46,9 +46,9 @@ public class TmfFilterCompareNodeTest extends TmfFilterTreeNodeTestBase {
     private ITmfEventField fContent1 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, fFields1);
     private ITmfEventField fContent2 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, fFields2);
     private ITmfEventField fContent3 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, fFields3);
-    private TmfEvent fEvent1 = new TmfEvent(TRACE, 0, new TmfNanoTimestamp(1), EVENT_TYPE, fContent1);
-    private TmfEvent fEvent2 = new TmfEvent(TRACE, 1, new TmfNanoTimestamp(2), EVENT_TYPE, fContent2);
-    private TmfEvent fEvent3 = new TmfEvent(TRACE, 2, new TmfNanoTimestamp(3), EVENT_TYPE, fContent3);
+    private TmfEvent fEvent1 = new TmfEvent(TRACE, 0, TmfTimestamp.fromNanos(1), EVENT_TYPE, fContent1);
+    private TmfEvent fEvent2 = new TmfEvent(TRACE, 1, TmfTimestamp.fromNanos(2), EVENT_TYPE, fContent2);
+    private TmfEvent fEvent3 = new TmfEvent(TRACE, 2, TmfTimestamp.fromNanos(3), EVENT_TYPE, fContent3);
     private TmfFilterCompareNode fFilter;
 
     // ------------------------------------------------------------------------
index 123614feb634ca829ca27029cfbaf1cb241144fb..34ccdaa300a91cdea3e793f26f75f337e03c588c 100644 (file)
@@ -22,7 +22,7 @@ import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.aspect.TmfContentFieldAspect;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterContainsNode;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -42,8 +42,8 @@ public class TmfFilterContainsNodeTest extends TmfFilterTreeNodeTestBase {
     private ITmfEventField[] fFields2 = new ITmfEventField[] { new TmfEventField(FIELD, "value 2", null) };
     private ITmfEventField fContent1 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, fFields1);
     private ITmfEventField fContent2 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, fFields2);
-    private TmfEvent fEvent1 = new TmfEvent(TRACE, 0, new TmfNanoTimestamp(1), EVENT_TYPE, fContent1);
-    private TmfEvent fEvent2 = new TmfEvent(TRACE, 1, new TmfNanoTimestamp(2), EVENT_TYPE, fContent2);
+    private TmfEvent fEvent1 = new TmfEvent(TRACE, 0, TmfTimestamp.fromNanos(1), EVENT_TYPE, fContent1);
+    private TmfEvent fEvent2 = new TmfEvent(TRACE, 1, TmfTimestamp.fromNanos(2), EVENT_TYPE, fContent2);
     private TmfFilterContainsNode fFilter;
 
     // ------------------------------------------------------------------------
index 33051722f734657aab57ffe884285d82af7b3343..b0e250d08e445bed4a371141daebc12d95d5d88a 100644 (file)
@@ -22,7 +22,7 @@ import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.aspect.TmfContentFieldAspect;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterEqualsNode;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -42,8 +42,8 @@ public class TmfFilterEqualsNodeTest extends TmfFilterTreeNodeTestBase {
     private ITmfEventField[] fFields2 = new ITmfEventField[] { new TmfEventField(FIELD, "value 2", null) };
     private ITmfEventField fContent1 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, fFields1);
     private ITmfEventField fContent2 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, fFields2);
-    private TmfEvent fEvent1 = new TmfEvent(TRACE, 0, new TmfNanoTimestamp(1), EVENT_TYPE, fContent1);
-    private TmfEvent fEvent2 = new TmfEvent(TRACE, 1, new TmfNanoTimestamp(2), EVENT_TYPE, fContent2);
+    private TmfEvent fEvent1 = new TmfEvent(TRACE, 0, TmfTimestamp.fromNanos(1), EVENT_TYPE, fContent1);
+    private TmfEvent fEvent2 = new TmfEvent(TRACE, 1, TmfTimestamp.fromNanos(2), EVENT_TYPE, fContent2);
     private TmfFilterEqualsNode fFilter;
 
     // ------------------------------------------------------------------------
index c16e08e5f904748d16ccab66a6d1218f5189f368..8210567b50be60a17fb6d138ff37e7557bf22a25 100644 (file)
@@ -22,7 +22,7 @@ import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.aspect.TmfContentFieldAspect;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterMatchesNode;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -42,8 +42,8 @@ public class TmfFilterMatchesNodeTest extends TmfFilterTreeNodeTestBase {
     private ITmfEventField[] fFields2 = new ITmfEventField[] { new TmfEventField(FIELD, "value 2", null) };
     private ITmfEventField fContent1 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, fFields1);
     private ITmfEventField fContent2 = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, fFields2);
-    private TmfEvent fEvent1 = new TmfEvent(TRACE, 0, new TmfNanoTimestamp(1), EVENT_TYPE, fContent1);
-    private TmfEvent fEvent2 = new TmfEvent(TRACE, 1, new TmfNanoTimestamp(2), EVENT_TYPE, fContent2);
+    private TmfEvent fEvent1 = new TmfEvent(TRACE, 0, TmfTimestamp.fromNanos(1), EVENT_TYPE, fContent1);
+    private TmfEvent fEvent2 = new TmfEvent(TRACE, 1, TmfTimestamp.fromNanos(2), EVENT_TYPE, fContent2);
     private TmfFilterMatchesNode fFilter;
 
     // ------------------------------------------------------------------------
index 27b74bc782b92c7079be8891b12a30de58b99fc0..32eb05e1c63c7a286881fd2f6a0101d2c121759a 100644 (file)
@@ -31,7 +31,7 @@ import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterMatchesNode;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterNode;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterOrNode;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterTraceTypeNode;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -49,7 +49,7 @@ public class TmfFilterNodeTest extends TmfFilterTreeNodeTestBase {
 
     private static final String FILTER = "filter";
     private ITmfEventField fContent = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, null);
-    private TmfEvent fEvent = new TmfEvent(TRACE, 0, new TmfNanoTimestamp(1), EVENT_TYPE, fContent);
+    private TmfEvent fEvent = new TmfEvent(TRACE, 0, TmfTimestamp.fromNanos(1), EVENT_TYPE, fContent);
     private TmfFilterNode fFilter;
 
     // ------------------------------------------------------------------------
index 8c0a7ffe1b10652176d4103d711829e4b52feb28..f78b99556b0bb70d499601c1dda11c067cda9e05 100644 (file)
@@ -30,7 +30,7 @@ import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterEqualsNode;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterMatchesNode;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterOrNode;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterTraceTypeNode;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -47,7 +47,7 @@ public class TmfFilterOrNodeTest extends TmfFilterTreeNodeTestBase {
     // ------------------------------------------------------------------------
 
     private ITmfEventField fContent = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, null);
-    private TmfEvent fEvent = new TmfEvent(TRACE, 0, new TmfNanoTimestamp(1), EVENT_TYPE, fContent);
+    private TmfEvent fEvent = new TmfEvent(TRACE, 0, TmfTimestamp.fromNanos(1), EVENT_TYPE, fContent);
     private TmfFilterOrNode fFilter;
 
     // ------------------------------------------------------------------------
index bcd444f644661363318c4b997dd6996d2c225b3a..41c3c1c532503a18596bd83186bdb0c65f6f7ef6 100644 (file)
@@ -22,7 +22,7 @@ import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterNode;
 import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterRootNode;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -39,7 +39,7 @@ public class TmfFilterRootNodeTest extends TmfFilterTreeNodeTestBase {
     // ------------------------------------------------------------------------
 
     private ITmfEventField fContent = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, null);
-    private TmfEvent fEvent = new TmfEvent(TRACE, 0, new TmfNanoTimestamp(1), EVENT_TYPE, fContent);
+    private TmfEvent fEvent = new TmfEvent(TRACE, 0, TmfTimestamp.fromNanos(1), EVENT_TYPE, fContent);
     private TmfFilterRootNode fFilter;
 
     // ------------------------------------------------------------------------
index e9cac2952bcd34ecb8bfb3751067d09c6735167d..7ecbb3b3357f6b8ae4d6d8a3e2b3eee512e95fe3 100644 (file)
@@ -40,7 +40,7 @@ import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlEventType;
 import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlInputElement;
 import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTrace;
 import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTraceDefinition;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -79,9 +79,9 @@ public class TmfFilterTraceTypeNodeTest extends TmfFilterTreeNodeTestBase {
     private static TmfEventType fCustomTxtEventType = new CustomTxtEventType(fCustomTxtDefinition);
     private static TmfEventType fCustomXmlEventType = new CustomXmlEventType(fCustomXmlDefinition);
     private ITmfEventField fContent = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, null);
-    private TmfEvent fEvent1 = new TmfEvent(TRACE, 0, new TmfNanoTimestamp(1), EVENT_TYPE, fContent);
-    private TmfEvent fEvent2 = new CustomTxtEvent(fCustomTxtDefinition, fCustomTxtTrace, new TmfNanoTimestamp(2), fCustomTxtEventType);
-    private TmfEvent fEvent3 = new CustomXmlEvent(fCustomXmlDefinition, fCustomXmlTrace, new TmfNanoTimestamp(3), fCustomXmlEventType);
+    private TmfEvent fEvent1 = new TmfEvent(TRACE, 0, TmfTimestamp.fromNanos(1), EVENT_TYPE, fContent);
+    private TmfEvent fEvent2 = new CustomTxtEvent(fCustomTxtDefinition, fCustomTxtTrace, TmfTimestamp.fromNanos(2), fCustomTxtEventType);
+    private TmfEvent fEvent3 = new CustomXmlEvent(fCustomXmlDefinition, fCustomXmlTrace, TmfTimestamp.fromNanos(3), fCustomXmlEventType);
     private TmfFilterTraceTypeNode fFilter;
 
     @AfterClass
index 20e90d02e3b84793865fd9300246ab448e3039e2..e9ad4cadd6514407e65909b8d01082984cf5c7e2 100644 (file)
@@ -37,6 +37,7 @@ import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
 import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
 import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.tests.stubs.request.TmfEventRequestStub;
@@ -55,7 +56,7 @@ public class TmfCoalescedEventRequestTest {
     // ------------------------------------------------------------------------
 
     private final TmfTimeRange range1 = TmfTimeRange.ETERNITY;
-    private final TmfTimeRange range2 = new TmfTimeRange(new TmfTimestamp(), TmfTimestamp.BIG_CRUNCH);
+    private final TmfTimeRange range2 = new TmfTimeRange(TmfTimestamp.create(0, ITmfTimestamp.SECOND_SCALE), TmfTimestamp.BIG_CRUNCH);
 
     private TmfCoalescedEventRequest fRequest1;
     private TmfCoalescedEventRequest fRequest2;
@@ -438,7 +439,7 @@ public class TmfCoalescedEventRequestTest {
      */
     @TmfSignalHandler
     public void trigger(final TmfTestTriggerSignal2 signal) {
-        TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(100, -3), TmfTimestamp.BIG_CRUNCH);
+        TmfTimeRange range = new TmfTimeRange(TmfTimestamp.create(100, -3), TmfTimestamp.BIG_CRUNCH);
         requestedEvents1 = new Vector<>();
         request1 = new TmfEventRequest(ITmfEvent.class, range, 0, 1, ExecutionType.FOREGROUND) {
             @Override
index cc58654fd9b312bea90762bc69ba155b3ed3aed0..fbc536567c06147d7d6d69e02ba9244f5e12d2be 100644 (file)
@@ -38,7 +38,7 @@ public class TmfEventRequestTest {
     // ------------------------------------------------------------------------
 
     private static TmfTimeRange range1 = TmfTimeRange.ETERNITY;
-    private static TmfTimeRange range2 = new TmfTimeRange(new TmfTimestamp(), TmfTimestamp.BIG_CRUNCH);
+    private static TmfTimeRange range2 = new TmfTimeRange(TmfTimestamp.fromSeconds(0), TmfTimestamp.BIG_CRUNCH);
 
     private static TmfEventRequest fRequest1;
     private static TmfEventRequest fRequest2;
@@ -115,12 +115,12 @@ public class TmfEventRequestTest {
 
     @Test
     public void testTmfEventRequestTimeRange() {
-        TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(), TmfTimestamp.BIG_CRUNCH);
+        TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromSeconds(0), TmfTimestamp.BIG_CRUNCH);
         TmfEventRequest request = new TmfEventRequestStub(ITmfEvent.class, range);
 
         assertEquals("getDataType",  ITmfEvent.class, request.getDataType());
 
-        assertEquals("StartTime", new TmfTimestamp(), request.getRange().getStartTime());
+        assertEquals("StartTime", TmfTimestamp.fromSeconds(0), request.getRange().getStartTime());
         assertEquals("EndTime", TmfTimestamp.BIG_CRUNCH, request.getRange().getEndTime());
 
         assertEquals("getIndex", 0, request.getIndex());
@@ -135,12 +135,12 @@ public class TmfEventRequestTest {
 
     @Test
     public void testTmfEventRequestTimeRangeNbRequested() {
-        TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(), TmfTimestamp.BIG_CRUNCH);
+        TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromSeconds(0), TmfTimestamp.BIG_CRUNCH);
         TmfEventRequest request = new TmfEventRequestStub(ITmfEvent.class, range, 100);
 
         assertEquals("getDataType",  ITmfEvent.class, request.getDataType());
 
-        assertEquals("StartTime", new TmfTimestamp(), request.getRange().getStartTime());
+        assertEquals("StartTime", TmfTimestamp.fromSeconds(0), request.getRange().getStartTime());
         assertEquals("EndTime", TmfTimestamp.BIG_CRUNCH, request.getRange().getEndTime());
 
         assertEquals("getIndex", 0, request.getIndex());
@@ -155,12 +155,12 @@ public class TmfEventRequestTest {
 
     @Test
     public void testTmfEventRequestTimeRangeNbRequestedBlocksize() {
-        TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(), TmfTimestamp.BIG_CRUNCH);
+        TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromSeconds(0), TmfTimestamp.BIG_CRUNCH);
         TmfEventRequest request = new TmfEventRequestStub(ITmfEvent.class, range, 100, 200);
 
         assertEquals("getDataType",  ITmfEvent.class, request.getDataType());
 
-        assertEquals("StartTime", new TmfTimestamp(), request.getRange().getStartTime());
+        assertEquals("StartTime", TmfTimestamp.fromSeconds(0), request.getRange().getStartTime());
         assertEquals("EndTime", TmfTimestamp.BIG_CRUNCH, request.getRange().getEndTime());
 
         assertEquals("getIndex", 0, request.getIndex());
index 76c1ec9766e199ba0eb14e280ec5e7ee06c74cf1..83c1150b801bce47db60f381517153d5edb459e8 100644 (file)
@@ -31,7 +31,7 @@ import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
 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.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub;
 
@@ -113,7 +113,7 @@ class TmfMipmapStateProviderStub extends AbstractTmfMipmapStateProvider {
         } else {
             value = TmfStateValue.nullValue();
         }
-        ITmfTimestamp timestamp = new TmfNanoTimestamp(time);
+        ITmfTimestamp timestamp = TmfTimestamp.fromNanos(time);
         ITmfEventType eventType = new TmfEventType(MIPMAP_ID, null);
         ITmfEventField content = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, value, null);
         ITmfEvent event = new TmfEvent(null, ITmfContext.UNKNOWN_RANK, timestamp, eventType, content);
index a3c55e007798edcfa59b9e9ee40baaa965d9b91b..d74d1b65499b58c95c3121f280b0c3b2a7062bc4 100644 (file)
@@ -25,8 +25,8 @@ import org.eclipse.tracecompass.statesystem.core.backend.StateHistoryBackendFact
 import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
-import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue.Type;
+import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
index ac380039926eb2995e8a317d1dd726cec0563b57..5d6b94a23800e7703d4ded6634fb6e7366b06565 100644 (file)
@@ -195,8 +195,8 @@ public class SyncTest {
     private static void addSyncMatch(SynchronizationAlgorithm algo, ITmfTrace sender, long sendTs, ITmfTrace receiver, long receiveTs) {
         algo.addMatch(
                 new TmfEventDependency(
-                        new TmfSyncEventStub(sender, new TmfTimestamp(sendTs)),
-                        new TmfSyncEventStub(receiver, new TmfTimestamp(receiveTs))
+                        new TmfSyncEventStub(sender, TmfTimestamp.fromSeconds(sendTs)),
+                        new TmfSyncEventStub(receiver, TmfTimestamp.fromSeconds(receiveTs))
                 ));
     }
 
index 1374e187793d875f1136a84313c204cbd59fddb6..78de389de5b4831d724ea36b8675933228a0a425 100644 (file)
@@ -22,7 +22,6 @@ import org.eclipse.tracecompass.internal.tmf.core.synchronization.TmfConstantTra
 import org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform;
 import org.eclipse.tracecompass.tmf.core.synchronization.TimestampTransformFactory;
 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;
 
@@ -34,18 +33,18 @@ import org.junit.Test;
  */
 @NonNullByDefault
 public class TsTransformFactoryTest {
-    private final ITmfTimestamp t0 = new TmfTimestamp(0);
-    private final ITmfTimestamp t100 = new TmfTimestamp(100);
-    private final ITmfTimestamp t1e2 = new TmfTimestamp(1, 2);
-    private final ITmfTimestamp t1e3 = new TmfTimestamp(1, 3);
-    private final ITmfTimestamp tn0 = new TmfNanoTimestamp(0);
-    private final ITmfTimestamp tn100 = new TmfNanoTimestamp(100);
-    private final ITmfTimestamp tn1 = new TmfNanoTimestamp(1);
-    private final ITmfTimestampTransform identity1 = TimestampTransformFactory.createLinear(1.0, new TmfNanoTimestamp(0));
+    private final ITmfTimestamp t0 = TmfTimestamp.fromSeconds(0);
+    private final ITmfTimestamp t100 = TmfTimestamp.fromSeconds(100);
+    private final ITmfTimestamp t1e2 = TmfTimestamp.create(1, 2);
+    private final ITmfTimestamp t1e3 = TmfTimestamp.create(1, 3);
+    private final ITmfTimestamp tn0 = TmfTimestamp.fromNanos(0);
+    private final ITmfTimestamp tn100 = TmfTimestamp.fromNanos(100);
+    private final ITmfTimestamp tn1 = TmfTimestamp.fromNanos(1);
+    private final ITmfTimestampTransform identity1 = TimestampTransformFactory.createLinear(1.0, TmfTimestamp.fromNanos(0));
     private final ITmfTimestampTransform offset1 = TimestampTransformFactory.createWithOffset(100);
     private final ITmfTimestampTransform offset2 = TimestampTransformFactory.createLinear(NonNullUtils.checkNotNull(BigDecimal.ONE), NonNullUtils.checkNotNull(new BigDecimal(100)));
     private final ITmfTimestampTransform offset3 = TimestampTransformFactory.createLinear(1.0, 100);
-    private final ITmfTimestampTransform offset4 = TimestampTransformFactory.createLinear(1.0, new TmfNanoTimestamp(100));
+    private final ITmfTimestampTransform offset4 = TimestampTransformFactory.createLinear(1.0, TmfTimestamp.fromNanos(100));
 
     /**
      * Test with identity
@@ -79,7 +78,7 @@ public class TsTransformFactoryTest {
     @Test
     public void transformOffset() {
         final ITmfTimestampTransform offset = offset1;
-        final ITmfTimestampTransform compositeTransform = offset.composeWith(TimestampTransformFactory.createWithOffset(new TmfNanoTimestamp(-100)));
+        final ITmfTimestampTransform compositeTransform = offset.composeWith(TimestampTransformFactory.createWithOffset(TmfTimestamp.fromNanos(-100)));
         assertEquals(tn100, offset.transform(t0));
         assertEquals(tn100, offset.transform(tn0));
         assertEquals(tn0, compositeTransform.transform(tn0));
@@ -96,12 +95,12 @@ public class TsTransformFactoryTest {
     @Test
     public void transformSlope() {
         final ITmfTimestampTransform slope = TimestampTransformFactory.createLinear(10, 0);
-        final ITmfTimestampTransform slope1 = TimestampTransformFactory.createLinear(10.0, new TmfNanoTimestamp(0));
+        final ITmfTimestampTransform slope1 = TimestampTransformFactory.createLinear(10.0, TmfTimestamp.fromNanos(0));
         assertEquals(t1e3, slope.transform(t1e2));
-        assertEquals(tn100, slope.transform(new TmfNanoTimestamp(10)));
+        assertEquals(tn100, slope.transform(TmfTimestamp.fromNanos(10)));
         assertEquals(tn100, slope.transform(slope.transform(tn1)));
         assertEquals(tn100, slope.composeWith(slope).transform(tn1));
-        assertEquals(tn100, slope1.transform(new TmfNanoTimestamp(10)));
+        assertEquals(tn100, slope1.transform(TmfTimestamp.fromNanos(10)));
     }
 
     /**
index 017fecdb3e62511e65589407d0f982dabee20a31..7839cdc448c4db625371577c2890de5d067e855b 100644 (file)
@@ -37,7 +37,7 @@ import org.junit.Test;
 public class TsTransformTest {
 
     private static final long ts = 1361657893526374091L;
-    private static final @NonNull ITmfTimestamp oTs = new TmfTimestamp(ts);
+    private static final @NonNull ITmfTimestamp oTs = TmfTimestamp.fromSeconds(ts);
 
     /**
      * Test the linear transform
index d5b00de491cf123908fc696393bb65d4051f5036..4f3a45dd52aab6d6b9eb1dd0302203b7c50557f0 100644 (file)
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.core.trace.TmfContext;
@@ -38,7 +39,7 @@ public class TmfContextTest {
     // ------------------------------------------------------------------------
 
     private final Long aLong = 12345L;
-    private final TmfTimestamp aTimestamp = new TmfTimestamp();
+    private final ITmfTimestamp aTimestamp = TmfTimestamp.fromSeconds(0);
 
     private final TmfLongLocation fLocation1 = new TmfLongLocation(aLong);
     private final TmfTimestampLocation fLocation2 = new TmfTimestampLocation(aTimestamp);
index 87b48e6b7ce1538434f763f47693660c1ff42fe3..1649a39655b9a071b4c9fd8b9b9f4712ffdb88d6 100644 (file)
@@ -190,14 +190,14 @@ public class TmfExperimentTest {
 
     @Test
     public void testGetTimestamp() {
-        assertEquals("getTimestamp", new TmfTimestamp(    1, (byte) -3), fExperiment.getTimestamp(   0));
-        assertEquals("getTimestamp", new TmfTimestamp(    2, (byte) -3), fExperiment.getTimestamp(   1));
-        assertEquals("getTimestamp", new TmfTimestamp(   11, (byte) -3), fExperiment.getTimestamp(  10));
-        assertEquals("getTimestamp", new TmfTimestamp(  101, (byte) -3), fExperiment.getTimestamp( 100));
-        assertEquals("getTimestamp", new TmfTimestamp( 1001, (byte) -3), fExperiment.getTimestamp(1000));
-        assertEquals("getTimestamp", new TmfTimestamp( 2001, (byte) -3), fExperiment.getTimestamp(2000));
-        assertEquals("getTimestamp", new TmfTimestamp( 2501, (byte) -3), fExperiment.getTimestamp(2500));
-        assertEquals("getTimestamp", new TmfTimestamp(10000, (byte) -3), fExperiment.getTimestamp(9999));
+        assertEquals("getTimestamp", TmfTimestamp.create(    1, (byte) -3), fExperiment.getTimestamp(   0));
+        assertEquals("getTimestamp", TmfTimestamp.create(    2, (byte) -3), fExperiment.getTimestamp(   1));
+        assertEquals("getTimestamp", TmfTimestamp.create(   11, (byte) -3), fExperiment.getTimestamp(  10));
+        assertEquals("getTimestamp", TmfTimestamp.create(  101, (byte) -3), fExperiment.getTimestamp( 100));
+        assertEquals("getTimestamp", TmfTimestamp.create( 1001, (byte) -3), fExperiment.getTimestamp(1000));
+        assertEquals("getTimestamp", TmfTimestamp.create( 2001, (byte) -3), fExperiment.getTimestamp(2000));
+        assertEquals("getTimestamp", TmfTimestamp.create( 2501, (byte) -3), fExperiment.getTimestamp(2500));
+        assertEquals("getTimestamp", TmfTimestamp.create(10000, (byte) -3), fExperiment.getTimestamp(9999));
         assertNull("getTimestamp", fExperiment.getTimestamp(10000));
     }
 
@@ -407,7 +407,7 @@ public class TmfExperimentTest {
         long cacheSize = fExperiment.getCacheSize();
 
         // Position trace at event rank 0
-        ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(1, SCALE));
+        ITmfContext context = fExperiment.seekEvent(TmfTimestamp.create(1, SCALE));
         assertEquals("Context rank", 0, context.getRank());
 
         ITmfEvent event = fExperiment.getNext(context);
@@ -415,7 +415,7 @@ public class TmfExperimentTest {
         assertEquals("Context rank", 1, context.getRank());
 
         // Position trace at event rank [cacheSize]
-        context = fExperiment.seekEvent(new TmfTimestamp(cacheSize + 1, SCALE));
+        context = fExperiment.seekEvent(TmfTimestamp.create(cacheSize + 1, SCALE));
         assertEquals("Event rank", cacheSize, context.getRank());
 
         event = fExperiment.getNext(context);
@@ -423,7 +423,7 @@ public class TmfExperimentTest {
         assertEquals("Context rank", cacheSize + 1, context.getRank());
 
         // Position trace at event rank [4 * cacheSize]
-        context = fExperiment.seekEvent(new TmfTimestamp(4 * cacheSize + 1, SCALE));
+        context = fExperiment.seekEvent(TmfTimestamp.create(4 * cacheSize + 1, SCALE));
         assertEquals("Context rank", 4 * cacheSize, context.getRank());
 
         event = fExperiment.getNext(context);
@@ -434,7 +434,7 @@ public class TmfExperimentTest {
     @Test
     public void testSeekTimestampNotOnCacheBoundary() {
         // Position trace at event rank 1 (TS = 2)
-        ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(2, SCALE));
+        ITmfContext context = fExperiment.seekEvent(TmfTimestamp.create(2, SCALE));
         assertEquals("Context rank", 1, context.getRank());
 
         ITmfEvent event = fExperiment.getNext(context);
@@ -442,7 +442,7 @@ public class TmfExperimentTest {
         assertEquals("Context rank", 2, context.getRank());
 
         // Position trace at event rank 9 (TS = 10)
-        context = fExperiment.seekEvent(new TmfTimestamp(10, SCALE));
+        context = fExperiment.seekEvent(TmfTimestamp.create(10, SCALE));
         assertEquals("Context rank", 9, context.getRank());
 
         event = fExperiment.getNext(context);
@@ -450,7 +450,7 @@ public class TmfExperimentTest {
         assertEquals("Context rank", 10, context.getRank());
 
         // Position trace at event rank 999 (TS = 1000)
-        context = fExperiment.seekEvent(new TmfTimestamp(1000, SCALE));
+        context = fExperiment.seekEvent(TmfTimestamp.create(1000, SCALE));
         assertEquals("Context rank", 999, context.getRank());
 
         event = fExperiment.getNext(context);
@@ -458,7 +458,7 @@ public class TmfExperimentTest {
         assertEquals("Context rank", 1000, context.getRank());
 
         // Position trace at event rank 1001 (TS = 1002)
-        context = fExperiment.seekEvent(new TmfTimestamp(1002, SCALE));
+        context = fExperiment.seekEvent(TmfTimestamp.create(1002, SCALE));
         assertEquals("Context rank", 1001, context.getRank());
 
         event = fExperiment.getNext(context);
@@ -466,7 +466,7 @@ public class TmfExperimentTest {
         assertEquals("Context rank", 1002, context.getRank());
 
         // Position trace at event rank 4500 (TS = 4501)
-        context = fExperiment.seekEvent(new TmfTimestamp(4501, SCALE));
+        context = fExperiment.seekEvent(TmfTimestamp.create(4501, SCALE));
         assertEquals("Context rank", 4500, context.getRank());
 
         event = fExperiment.getNext(context);
@@ -477,7 +477,7 @@ public class TmfExperimentTest {
     @Test
     public void testSeekTimestampOutOfScope() {
         // Position trace at beginning
-        ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(-1, SCALE));
+        ITmfContext context = fExperiment.seekEvent(TmfTimestamp.create(-1, SCALE));
         assertEquals("Event rank", 0, context.getRank());
 
         ITmfEvent event = fExperiment.getNext(context);
@@ -485,7 +485,7 @@ public class TmfExperimentTest {
         assertEquals("Event rank", 1, context.getRank());
 
         // Position trace at event passed the end
-        context = fExperiment.seekEvent(new TmfTimestamp(NB_EVENTS + 1, SCALE));
+        context = fExperiment.seekEvent(TmfTimestamp.create(NB_EVENTS + 1, SCALE));
         event = fExperiment.getNext(context);
         assertNull("Event location", event);
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
@@ -607,7 +607,7 @@ public class TmfExperimentTest {
         final int NB_READS = 20;
 
         // On lower bound, returns the first event (ts = 1)
-        final ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE));
+        final ITmfContext context = fExperiment.seekEvent(TmfTimestamp.create(INITIAL_TS, SCALE));
 
         validateContextRanks(context);
 
@@ -633,7 +633,7 @@ public class TmfExperimentTest {
         final int NB_READS = 20;
 
         // On lower bound, returns the first event (ts = 2)
-        final ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE));
+        final ITmfContext context = fExperiment.seekEvent(TmfTimestamp.create(INITIAL_TS, SCALE));
 
         validateContextRanks(context);
 
@@ -660,7 +660,7 @@ public class TmfExperimentTest {
         final int NB_READS = 20;
 
         // On lower bound, returns the first event (ts = 500)
-        final ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE));
+        final ITmfContext context = fExperiment.seekEvent(TmfTimestamp.create(INITIAL_TS, SCALE));
 
         validateContextRanks(context);
 
index e0f888e834033fb88fbbe1396200cf9a8bd0e466..40b0414f03ae5dd787063b19a989deaae38a813b 100644 (file)
@@ -33,8 +33,8 @@ import org.eclipse.tracecompass.internal.tmf.core.trace.experiment.TmfExperiment
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
 import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
 import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest.ExecutionType;
+import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
 import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
 import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
@@ -122,7 +122,7 @@ public class TmfMultiTraceExperimentTest {
         assertEquals("getStartTime", 1, timeRange.getStartTime().getValue());
         assertEquals("getEndTime", NB_EVENTS, timeRange.getEndTime().getValue());
 
-        TmfTimestamp initRange = new TmfTimestamp(DEFAULT_INITIAL_OFFSET_VALUE, ITmfTimestamp.NANOSECOND_SCALE);
+        ITmfTimestamp initRange = TmfTimestamp.fromNanos(DEFAULT_INITIAL_OFFSET_VALUE);
         assertEquals("getInitialRangeOffset", initRange, fExperiment.getInitialRangeOffset());
     }
 
@@ -224,7 +224,7 @@ public class TmfMultiTraceExperimentTest {
         long cacheSize = fExperiment.getCacheSize();
 
         // Position trace at event rank 0
-        ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(1, SCALE));
+        ITmfContext context = fExperiment.seekEvent(TmfTimestamp.create(1, SCALE));
         assertEquals("Context rank", 0, context.getRank());
 
         ITmfEvent event = fExperiment.getNext(context);
@@ -232,7 +232,7 @@ public class TmfMultiTraceExperimentTest {
         assertEquals("Context rank", 1, context.getRank());
 
         // Position trace at event rank [cacheSize]
-        context = fExperiment.seekEvent(new TmfTimestamp(cacheSize + 1, SCALE));
+        context = fExperiment.seekEvent(TmfTimestamp.create(cacheSize + 1, SCALE));
         assertEquals("Event rank", cacheSize, context.getRank());
 
         event = fExperiment.getNext(context);
@@ -240,7 +240,7 @@ public class TmfMultiTraceExperimentTest {
         assertEquals("Context rank", cacheSize + 1, context.getRank());
 
         // Position trace at event rank [4 * cacheSize]
-        context = fExperiment.seekEvent(new TmfTimestamp(4 * cacheSize + 1, SCALE));
+        context = fExperiment.seekEvent(TmfTimestamp.create(4 * cacheSize + 1, SCALE));
         assertEquals("Context rank", 4 * cacheSize, context.getRank());
 
         event = fExperiment.getNext(context);
@@ -251,7 +251,7 @@ public class TmfMultiTraceExperimentTest {
     @Test
     public void testSeekTimestampNotOnCacheBoundary() {
         // Position trace at event rank 1 (TS = 2)
-        ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(2, SCALE));
+        ITmfContext context = fExperiment.seekEvent(TmfTimestamp.create(2, SCALE));
         assertEquals("Context rank", 1, context.getRank());
 
         ITmfEvent event = fExperiment.getNext(context);
@@ -259,7 +259,7 @@ public class TmfMultiTraceExperimentTest {
         assertEquals("Context rank", 2, context.getRank());
 
         // Position trace at event rank 9 (TS = 10)
-        context = fExperiment.seekEvent(new TmfTimestamp(10, SCALE));
+        context = fExperiment.seekEvent(TmfTimestamp.create(10, SCALE));
         assertEquals("Context rank", 9, context.getRank());
 
         event = fExperiment.getNext(context);
@@ -267,7 +267,7 @@ public class TmfMultiTraceExperimentTest {
         assertEquals("Context rank", 10, context.getRank());
 
         // Position trace at event rank 999 (TS = 1000)
-        context = fExperiment.seekEvent(new TmfTimestamp(1000, SCALE));
+        context = fExperiment.seekEvent(TmfTimestamp.create(1000, SCALE));
         assertEquals("Context rank", 999, context.getRank());
 
         event = fExperiment.getNext(context);
@@ -275,7 +275,7 @@ public class TmfMultiTraceExperimentTest {
         assertEquals("Context rank", 1000, context.getRank());
 
         // Position trace at event rank 1001 (TS = 1002)
-        context = fExperiment.seekEvent(new TmfTimestamp(1002, SCALE));
+        context = fExperiment.seekEvent(TmfTimestamp.create(1002, SCALE));
         assertEquals("Context rank", 1001, context.getRank());
 
         event = fExperiment.getNext(context);
@@ -283,7 +283,7 @@ public class TmfMultiTraceExperimentTest {
         assertEquals("Context rank", 1002, context.getRank());
 
         // Position trace at event rank 4500 (TS = 4501)
-        context = fExperiment.seekEvent(new TmfTimestamp(4501, SCALE));
+        context = fExperiment.seekEvent(TmfTimestamp.create(4501, SCALE));
         assertEquals("Context rank", 4500, context.getRank());
 
         event = fExperiment.getNext(context);
@@ -294,7 +294,7 @@ public class TmfMultiTraceExperimentTest {
     @Test
     public void testSeekTimestampOutOfScope() {
         // Position trace at beginning
-        ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(-1, SCALE));
+        ITmfContext context = fExperiment.seekEvent(TmfTimestamp.create(-1, SCALE));
         assertEquals("Event rank", 0, context.getRank());
 
         ITmfEvent event = fExperiment.getNext(context);
@@ -302,7 +302,7 @@ public class TmfMultiTraceExperimentTest {
         assertEquals("Event rank", 1, context.getRank());
 
         // Position trace at event passed the end
-        context = fExperiment.seekEvent(new TmfTimestamp(NB_EVENTS + 1, SCALE));
+        context = fExperiment.seekEvent(TmfTimestamp.create(NB_EVENTS + 1, SCALE));
         event = fExperiment.getNext(context);
         assertNull("Event location", event);
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
@@ -423,7 +423,7 @@ public class TmfMultiTraceExperimentTest {
         final int NB_READS = 20;
 
         // On lower bound, returns the first event (ts = 1)
-        final ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE));
+        final ITmfContext context = fExperiment.seekEvent(TmfTimestamp.create(INITIAL_TS, SCALE));
 
         validateContextRanks(context);
 
@@ -449,7 +449,7 @@ public class TmfMultiTraceExperimentTest {
         final int NB_READS = 20;
 
         // On lower bound, returns the first event (ts = 2)
-        final ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE));
+        final ITmfContext context = fExperiment.seekEvent(TmfTimestamp.create(INITIAL_TS, SCALE));
 
         validateContextRanks(context);
 
@@ -475,7 +475,7 @@ public class TmfMultiTraceExperimentTest {
         final int NB_READS = 20;
 
         // On lower bound, returns the first event (ts = 500)
-        final ITmfContext context = fExperiment.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE));
+        final ITmfContext context = fExperiment.seekEvent(TmfTimestamp.create(INITIAL_TS, SCALE));
 
         validateContextRanks(context);
 
@@ -770,15 +770,15 @@ public class TmfMultiTraceExperimentTest {
 
     @Test
     public void testGetTimestamp() {
-        assertEquals("getTimestamp", new TmfTimestamp(    1, (byte) -3), fExperiment.getTimestamp(    0));
-        assertEquals("getTimestamp", new TmfTimestamp(    2, (byte) -3), fExperiment.getTimestamp(    1));
-        assertEquals("getTimestamp", new TmfTimestamp(   11, (byte) -3), fExperiment.getTimestamp(   10));
-        assertEquals("getTimestamp", new TmfTimestamp(  101, (byte) -3), fExperiment.getTimestamp(  100));
-        assertEquals("getTimestamp", new TmfTimestamp( 1001, (byte) -3), fExperiment.getTimestamp( 1000));
-        assertEquals("getTimestamp", new TmfTimestamp( 2001, (byte) -3), fExperiment.getTimestamp( 2000));
-        assertEquals("getTimestamp", new TmfTimestamp( 2501, (byte) -3), fExperiment.getTimestamp( 2500));
-        assertEquals("getTimestamp", new TmfTimestamp(10000, (byte) -3), fExperiment.getTimestamp( 9999));
-        assertEquals("getTimestamp", new TmfTimestamp(20000, (byte) -3), fExperiment.getTimestamp(19999));
+        assertEquals("getTimestamp", TmfTimestamp.create(    1, (byte) -3), fExperiment.getTimestamp(    0));
+        assertEquals("getTimestamp", TmfTimestamp.create(    2, (byte) -3), fExperiment.getTimestamp(    1));
+        assertEquals("getTimestamp", TmfTimestamp.create(   11, (byte) -3), fExperiment.getTimestamp(   10));
+        assertEquals("getTimestamp", TmfTimestamp.create(  101, (byte) -3), fExperiment.getTimestamp(  100));
+        assertEquals("getTimestamp", TmfTimestamp.create( 1001, (byte) -3), fExperiment.getTimestamp( 1000));
+        assertEquals("getTimestamp", TmfTimestamp.create( 2001, (byte) -3), fExperiment.getTimestamp( 2000));
+        assertEquals("getTimestamp", TmfTimestamp.create( 2501, (byte) -3), fExperiment.getTimestamp( 2500));
+        assertEquals("getTimestamp", TmfTimestamp.create(10000, (byte) -3), fExperiment.getTimestamp( 9999));
+        assertEquals("getTimestamp", TmfTimestamp.create(20000, (byte) -3), fExperiment.getTimestamp(19999));
         assertNull("getTimestamp", fExperiment.getTimestamp(20000));
     }
 
@@ -792,7 +792,7 @@ public class TmfMultiTraceExperimentTest {
         TmfExperimentStub exp = new TmfExperimentStub(EXPERIMENT, traces, BLOCK_SIZE);
 
         // verify initial values
-        TmfTimestamp initRange = new TmfTimestamp(DEFAULT_INITIAL_OFFSET_VALUE, ITmfTimestamp.NANOSECOND_SCALE);
+        ITmfTimestamp initRange = TmfTimestamp.fromNanos(DEFAULT_INITIAL_OFFSET_VALUE);
         assertEquals("getInitialRangeOffset", initRange, exp.getInitialRangeOffset());
 
         exp.dispose();
@@ -801,11 +801,11 @@ public class TmfMultiTraceExperimentTest {
     @Test
     public void testInitialRangeOffset() {
         ITmfTrace[] traces = setupTraces();
-        ((TmfTraceStub) traces[0]).setInitialRangeOffset(new TmfTimestamp(5, ITmfTimestamp.MILLISECOND_SCALE));
-        ((TmfTraceStub) traces[1]).setInitialRangeOffset(new TmfTimestamp(2, ITmfTimestamp.MILLISECOND_SCALE));
+        ((TmfTraceStub) traces[0]).setInitialRangeOffset(TmfTimestamp.fromMillis(5));
+        ((TmfTraceStub) traces[1]).setInitialRangeOffset(TmfTimestamp.fromMillis(2));
         TmfExperimentStub exp = new TmfExperimentStub(EXPERIMENT, traces, BLOCK_SIZE);
 
-        TmfTimestamp initRange = new TmfTimestamp(2, ITmfTimestamp.MILLISECOND_SCALE);
+        ITmfTimestamp initRange = TmfTimestamp.fromMillis(2);
         assertEquals("getInitialRangeOffset", initRange, exp.getInitialRangeOffset());
 
         exp.dispose();
index 1b0006aaf832772379a8a1b3aa3794ebefcd3003..9480f72f0178c2faf326235416064ae597861598 100644 (file)
@@ -379,7 +379,7 @@ public class TmfTraceTest {
         assertEquals("getStartTime",   1,         trace.getStartTime().getValue());
         assertEquals("getEndTime",     NB_EVENTS, trace.getEndTime().getValue());
 
-        trace.setTimeRange(new TmfTimeRange(new TmfTimestamp(100), new TmfTimestamp(200)));
+        trace.setTimeRange(new TmfTimeRange(TmfTimestamp.fromSeconds(100), TmfTimestamp.fromSeconds(200)));
         assertEquals("setTimeRange",   100, trace.getTimeRange().getStartTime().getValue());
         assertEquals("setTimeRange",   200, trace.getTimeRange().getEndTime().getValue());
         assertEquals("setTimeRange",   100, trace.getStartTime().getValue());
@@ -398,7 +398,7 @@ public class TmfTraceTest {
         assertEquals("getStartTime",   1,         trace.getStartTime().getValue());
         assertEquals("getEndTime",     NB_EVENTS, trace.getEndTime().getValue());
 
-        trace.setStartTime(new TmfTimestamp(100));
+        trace.setStartTime(TmfTimestamp.fromSeconds(100));
         assertEquals("setStartTime",   100,       trace.getTimeRange().getStartTime().getValue());
         assertEquals("setStartTime",   NB_EVENTS, trace.getTimeRange().getEndTime().getValue());
         assertEquals("setStartTime",   100,       trace.getStartTime().getValue());
@@ -417,7 +417,7 @@ public class TmfTraceTest {
         assertEquals("getStartTime",   1,         trace.getStartTime().getValue());
         assertEquals("getEndTime",     NB_EVENTS, trace.getEndTime().getValue());
 
-        trace.setEndTime(new TmfTimestamp(100));
+        trace.setEndTime(TmfTimestamp.fromSeconds(100));
         assertEquals("setEndTime",     1,   trace.getTimeRange().getStartTime().getValue());
         assertEquals("setEndTime",     100, trace.getTimeRange().getEndTime().getValue());
         assertEquals("setEndTime",     1,   trace.getStartTime().getValue());
@@ -508,7 +508,7 @@ public class TmfTraceTest {
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
         // Position trace at event rank 1000
-        ITmfContext tmpContext = fTrace.seekEvent(new TmfTimestamp(1001, SCALE));
+        ITmfContext tmpContext = fTrace.seekEvent(TmfTimestamp.create(1001, SCALE));
         context = fTrace.seekEvent(tmpContext.getLocation());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
@@ -521,7 +521,7 @@ public class TmfTraceTest {
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
         // Position trace at event rank 4000
-        tmpContext = fTrace.seekEvent(new TmfTimestamp(4001, SCALE));
+        tmpContext = fTrace.seekEvent(TmfTimestamp.create(4001, SCALE));
         context = fTrace.seekEvent(tmpContext.getLocation());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
@@ -537,7 +537,7 @@ public class TmfTraceTest {
     @Test
     public void testSeekEventNotOnCacheBoundary() {
         // Position trace at event rank 9
-        ITmfContext tmpContext = fTrace.seekEvent(new TmfTimestamp(10, SCALE));
+        ITmfContext tmpContext = fTrace.seekEvent(TmfTimestamp.create(10, SCALE));
         TmfContext context = fTrace.seekEvent(tmpContext.getLocation());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
@@ -550,7 +550,7 @@ public class TmfTraceTest {
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
         // Position trace at event rank 999
-        tmpContext = fTrace.seekEvent(new TmfTimestamp(1000, SCALE));
+        tmpContext = fTrace.seekEvent(TmfTimestamp.create(1000, SCALE));
         context = fTrace.seekEvent(tmpContext.getLocation());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
@@ -563,7 +563,7 @@ public class TmfTraceTest {
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
         // Position trace at event rank 1001
-        tmpContext = fTrace.seekEvent(new TmfTimestamp(1002, SCALE));
+        tmpContext = fTrace.seekEvent(TmfTimestamp.create(1002, SCALE));
         context = fTrace.seekEvent(tmpContext.getLocation());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
@@ -576,7 +576,7 @@ public class TmfTraceTest {
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
         // Position trace at event rank 4500
-        tmpContext = fTrace.seekEvent(new TmfTimestamp(4501, SCALE));
+        tmpContext = fTrace.seekEvent(TmfTimestamp.create(4501, SCALE));
         context = fTrace.seekEvent(tmpContext.getLocation());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
@@ -605,7 +605,7 @@ public class TmfTraceTest {
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
         // Position trace at event passed the end
-        context = fTrace.seekEvent(new TmfTimestamp(NB_EVENTS + 1, SCALE));
+        context = fTrace.seekEvent(TmfTimestamp.create(NB_EVENTS + 1, SCALE));
         assertNull("Event timestamp", context.getLocation());
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
@@ -631,7 +631,7 @@ public class TmfTraceTest {
     @Test
     public void testSeekEventOnTimestampOnCacheBoundary() {
         // Position trace at event rank 0
-        ITmfContext context = fTrace.seekEvent(new TmfTimestamp(1, SCALE));
+        ITmfContext context = fTrace.seekEvent(TmfTimestamp.create(1, SCALE));
         assertEquals("Event rank", 0, context.getRank());
 
         ITmfEvent event = fTrace.parseEvent(context);
@@ -643,7 +643,7 @@ public class TmfTraceTest {
         assertEquals("Event rank", 1, context.getRank());
 
         // Position trace at event rank 1000
-        context = fTrace.seekEvent(new TmfTimestamp(1001, SCALE));
+        context = fTrace.seekEvent(TmfTimestamp.create(1001, SCALE));
         assertEquals("Event rank", 1000, context.getRank());
 
         event = fTrace.parseEvent(context);
@@ -655,7 +655,7 @@ public class TmfTraceTest {
         assertEquals("Event rank", 1001, context.getRank());
 
         // Position trace at event rank 4000
-        context = fTrace.seekEvent(new TmfTimestamp(4001, SCALE));
+        context = fTrace.seekEvent(TmfTimestamp.create(4001, SCALE));
         assertEquals("Event rank", 4000, context.getRank());
 
         event = fTrace.parseEvent(context);
@@ -670,7 +670,7 @@ public class TmfTraceTest {
     @Test
     public void testSeekEventOnTimestampNotOnCacheBoundary() {
         // Position trace at event rank 1
-        ITmfContext context = fTrace.seekEvent(new TmfTimestamp(2, SCALE));
+        ITmfContext context = fTrace.seekEvent(TmfTimestamp.create(2, SCALE));
         assertEquals("Event rank", 1, context.getRank());
 
         ITmfEvent event = fTrace.parseEvent(context);
@@ -682,7 +682,7 @@ public class TmfTraceTest {
         assertEquals("Event rank", 2, context.getRank());
 
         // Position trace at event rank 9
-        context = fTrace.seekEvent(new TmfTimestamp(10, SCALE));
+        context = fTrace.seekEvent(TmfTimestamp.create(10, SCALE));
         assertEquals("Event rank", 9, context.getRank());
 
         event = fTrace.parseEvent(context);
@@ -694,7 +694,7 @@ public class TmfTraceTest {
         assertEquals("Event rank", 10, context.getRank());
 
         // Position trace at event rank 999
-        context = fTrace.seekEvent(new TmfTimestamp(1000, SCALE));
+        context = fTrace.seekEvent(TmfTimestamp.create(1000, SCALE));
         assertEquals("Event rank", 999, context.getRank());
 
         event = fTrace.parseEvent(context);
@@ -706,7 +706,7 @@ public class TmfTraceTest {
         assertEquals("Event rank", 1000, context.getRank());
 
         // Position trace at event rank 1001
-        context = fTrace.seekEvent(new TmfTimestamp(1002, SCALE));
+        context = fTrace.seekEvent(TmfTimestamp.create(1002, SCALE));
         assertEquals("Event rank", 1001, context.getRank());
 
         event = fTrace.parseEvent(context);
@@ -718,7 +718,7 @@ public class TmfTraceTest {
         assertEquals("Event rank", 1002, context.getRank());
 
         // Position trace at event rank 4500
-        context = fTrace.seekEvent(new TmfTimestamp(4501, SCALE));
+        context = fTrace.seekEvent(TmfTimestamp.create(4501, SCALE));
         assertEquals("Event rank", 4500, context.getRank());
 
         event = fTrace.parseEvent(context);
@@ -733,7 +733,7 @@ public class TmfTraceTest {
     @Test
     public void testSeekEventOnTimestampOutOfScope() {
         // Position trace at beginning
-        ITmfContext context = fTrace.seekEvent(new TmfTimestamp(-1, SCALE));
+        ITmfContext context = fTrace.seekEvent(TmfTimestamp.create(-1, SCALE));
         assertEquals("Event rank", 0, context.getRank());
 
         ITmfEvent event = fTrace.parseEvent(context);
@@ -745,7 +745,7 @@ public class TmfTraceTest {
         assertEquals("Event rank", 1, context.getRank());
 
         // Position trace at event passed the end
-        context = fTrace.seekEvent(new TmfTimestamp(NB_EVENTS + 1, SCALE));
+        context = fTrace.seekEvent(TmfTimestamp.create(NB_EVENTS + 1, SCALE));
         assertEquals("Event rank", ITmfContext.UNKNOWN_RANK, context.getRank());
 
         event = fTrace.parseEvent(context);
@@ -898,7 +898,7 @@ public class TmfTraceTest {
         final int NB_READS = 20;
 
         // On lower bound, returns the first event (ts = 0)
-        final TmfContext context = (TmfContext) fTrace.seekEvent(new TmfTimestamp(0, SCALE));
+        final TmfContext context = (TmfContext) fTrace.seekEvent(TmfTimestamp.create(0, SCALE));
         TmfContext svContext = new TmfContext(context);
 
         ITmfEvent event = fTrace.parseEvent(context);
@@ -944,7 +944,7 @@ public class TmfTraceTest {
         final int NB_READS = 20;
 
         // On lower bound, returns the first event (ts = 1)
-        final ITmfContext context = fTrace.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE));
+        final ITmfContext context = fTrace.seekEvent(TmfTimestamp.create(INITIAL_TS, SCALE));
 
         // Read NB_EVENTS
         ITmfEvent event;
@@ -966,7 +966,7 @@ public class TmfTraceTest {
         final int NB_READS = 20;
 
         // On lower bound, returns the first event (ts = 500)
-        final ITmfContext context = fTrace.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE));
+        final ITmfContext context = fTrace.seekEvent(TmfTimestamp.create(INITIAL_TS, SCALE));
 
         // Read NB_EVENTS
         ITmfEvent event;
@@ -988,7 +988,7 @@ public class TmfTraceTest {
         final int NB_READS = 20;
 
         // On lower bound, returns the first event (ts = 500)
-        final ITmfContext context = fTrace.seekEvent(new TmfTimestamp(INITIAL_TS, SCALE));
+        final ITmfContext context = fTrace.seekEvent(TmfTimestamp.create(INITIAL_TS, SCALE));
 
         // Read NB_EVENTS
         ITmfEvent event;
@@ -1223,7 +1223,7 @@ public class TmfTraceTest {
         final int nbEvents  = 1000;
         final Vector<ITmfEvent> requestedEvents = new Vector<>();
 
-        final TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(startTime, SCALE), TmfTimestamp.BIG_CRUNCH);
+        final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.create(startTime, SCALE), TmfTimestamp.BIG_CRUNCH);
         final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
                 range, 0, nbEvents, ExecutionType.FOREGROUND) {
             @Override
@@ -1254,7 +1254,7 @@ public class TmfTraceTest {
         final int nbEvents  = 1000;
         final Vector<ITmfEvent> requestedEvents = new Vector<>();
 
-        final TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(startTime, SCALE), TmfTimestamp.BIG_CRUNCH);
+        final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.create(startTime, SCALE), TmfTimestamp.BIG_CRUNCH);
         final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
                 range, startIndex, nbEvents, ExecutionType.FOREGROUND) {
             @Override
@@ -1381,12 +1381,12 @@ public class TmfTraceTest {
             testfile = new File(FileLocator.toFileURL(location).toURI());
             trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
             // verify initial values
-            TmfTimestamp defaultInitRange = new TmfTimestamp(DEFAULT_INITIAL_OFFSET_VALUE, ITmfTimestamp.NANOSECOND_SCALE);
+            ITmfTimestamp defaultInitRange = TmfTimestamp.fromNanos(DEFAULT_INITIAL_OFFSET_VALUE);
             assertEquals("getInitialRangeOffset", defaultInitRange, trace.getInitialRangeOffset());
-            trace.setInitialRangeOffset(new TmfTimestamp(5, ITmfTimestamp.MILLISECOND_SCALE));
+            trace.setInitialRangeOffset(TmfTimestamp.fromMillis(5));
             trace.indexTrace(true);
 
-            TmfTimestamp initRange = new TmfTimestamp(5, ITmfTimestamp.MILLISECOND_SCALE);
+            ITmfTimestamp initRange = TmfTimestamp.fromMillis(5);
             assertEquals("getInitialRangeOffset", initRange, trace.getInitialRangeOffset());
 
             trace.dispose();
index 2fd655eecfeb4a8fd75253c34ff2758a1c8d2f19..65c2c15f3ae68cfd5fe8e9bbc2ff9c83f20da019 100644 (file)
@@ -154,7 +154,7 @@ public abstract class AbstractCheckpointCollectionTest {
     @Test
     public void testSetGetTimeRange() {
         if (isPersistableCollection()) {
-            TmfTimeRange timeRange = new TmfTimeRange(new TmfTimestamp(0), new TmfTimestamp(100));
+            TmfTimeRange timeRange = new TmfTimeRange(TmfTimestamp.fromSeconds(0), TmfTimestamp.fromSeconds(100));
             fCheckpointCollection.setTimeRange(timeRange);
             assertEquals(timeRange, fCheckpointCollection.getTimeRange());
         }
@@ -187,7 +187,7 @@ public abstract class AbstractCheckpointCollectionTest {
         assertEquals(0, fCheckpointCollection.size());
         int expected = CHECKPOINTS_INSERT_NUM;
         for (int i = 0; i < expected; ++i) {
-            fCheckpointCollection.insert(new TmfCheckpoint(new TmfTimestamp(i), new TmfLongLocation(i), i));
+            fCheckpointCollection.insert(new TmfCheckpoint(TmfTimestamp.fromSeconds(i), new TmfLongLocation(i), i));
         }
         assertEquals(expected, fCheckpointCollection.size());
     }
@@ -252,7 +252,7 @@ public abstract class AbstractCheckpointCollectionTest {
      */
     @Test
     public void testInsert() {
-        TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345), new TmfLongLocation(123456L), 0);
+        TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(12345), new TmfLongLocation(123456L), 0);
         fCheckpointCollection.insert(checkpoint);
 
         long found = fCheckpointCollection.binarySearch(checkpoint);
@@ -267,7 +267,7 @@ public abstract class AbstractCheckpointCollectionTest {
      */
     protected ArrayList<Integer> insertAlot() {
         for (int i = 0; i < CHECKPOINTS_INSERT_NUM; i++) {
-            TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345 + i), new TmfLongLocation(123456L + i), i);
+            TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(12345 + i), new TmfLongLocation(123456L + i), i);
             fCheckpointCollection.insert(checkpoint);
         }
 
@@ -304,7 +304,7 @@ public abstract class AbstractCheckpointCollectionTest {
 
         for (int i = 0; i < CHECKPOINTS_INSERT_NUM; i++) {
             Integer randomCheckpoint = list.get(i);
-            TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345 + randomCheckpoint), new TmfLongLocation(123456L + randomCheckpoint), 0);
+            TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(12345 + randomCheckpoint), new TmfLongLocation(123456L + randomCheckpoint), 0);
             long found = fCheckpointCollection.binarySearch(checkpoint);
             assertEquals(randomCheckpoint.intValue(), found);
         }
@@ -319,7 +319,7 @@ public abstract class AbstractCheckpointCollectionTest {
     @Test
     public void testInsertSameTimestamp() {
         for (int i = 0; i < CHECKPOINTS_INSERT_NUM; i++) {
-            TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345), new TmfLongLocation(123456L + i), i);
+            TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(12345), new TmfLongLocation(123456L + i), i);
             fCheckpointCollection.insert(checkpoint);
         }
         assertEquals(CHECKPOINTS_INSERT_NUM, fCheckpointCollection.size());
@@ -346,7 +346,7 @@ public abstract class AbstractCheckpointCollectionTest {
 
         for (int i = 0; i < CHECKPOINTS_INSERT_NUM; i++) {
             Integer randomCheckpoint = list.get(i);
-            TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345), new TmfLongLocation(123456L + randomCheckpoint), 0);
+            TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(12345), new TmfLongLocation(123456L + randomCheckpoint), 0);
             long found = fCheckpointCollection.binarySearch(checkpoint);
             assertEquals(randomCheckpoint.intValue(), found);
         }
@@ -359,12 +359,12 @@ public abstract class AbstractCheckpointCollectionTest {
     @Test
     public void testBinarySearchFindInBetween() {
         for (long i = 0; i < CHECKPOINTS_INSERT_NUM; i++) {
-            TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(2 * i), new TmfLongLocation(2 * i), i);
+            TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(2 * i), new TmfLongLocation(2 * i), i);
             fCheckpointCollection.insert(checkpoint);
         }
         assertEquals(CHECKPOINTS_INSERT_NUM, fCheckpointCollection.size());
 
-        TmfCheckpoint searchedCheckpoint = new TmfCheckpoint(new TmfTimestamp(123), new TmfLongLocation(123L), 123);
+        TmfCheckpoint searchedCheckpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(123), new TmfLongLocation(123L), 123);
         int expectedInsertionPoint = 61;
         int expectedRank = -(expectedInsertionPoint + 2);
 
@@ -382,17 +382,17 @@ public abstract class AbstractCheckpointCollectionTest {
     public void testBinarySearchInBetweenSameTimestamp() {
         int checkpointNum = 0;
         for (; checkpointNum < CHECKPOINTS_INSERT_NUM / 2; checkpointNum++) {
-            TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(0), new TmfLongLocation(checkpointNum), checkpointNum);
+            TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(0), new TmfLongLocation(checkpointNum), checkpointNum);
             fCheckpointCollection.insert(checkpoint);
         }
 
         for (; checkpointNum < CHECKPOINTS_INSERT_NUM; checkpointNum++) {
-            TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(1), new TmfLongLocation(checkpointNum), checkpointNum);
+            TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(1), new TmfLongLocation(checkpointNum), checkpointNum);
             fCheckpointCollection.insert(checkpoint);
         }
         assertEquals(CHECKPOINTS_INSERT_NUM, fCheckpointCollection.size());
 
-        final TmfCheckpoint searchedCheckpoint = new TmfCheckpoint(new TmfTimestamp(1), null, 0);
+        final TmfCheckpoint searchedCheckpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(1), null, 0);
 
         long found = fCheckpointCollection.binarySearch(searchedCheckpoint);
 
@@ -411,7 +411,7 @@ public abstract class AbstractCheckpointCollectionTest {
             return;
         }
 
-        fCheckpointCollection.insert(new TmfCheckpoint(new TmfTimestamp(12345), new TmfLongLocation(123456L), 0));
+        fCheckpointCollection.insert(new TmfCheckpoint(TmfTimestamp.fromSeconds(12345), new TmfLongLocation(123456L), 0));
 
         assertEquals(1, fCheckpointCollection.size());
 
@@ -419,11 +419,11 @@ public abstract class AbstractCheckpointCollectionTest {
         fCheckpointCollection = createCollection();
         assertEquals(1, fCheckpointCollection.size());
 
-        TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345), new TmfLongLocation(123456L), 0);
+        TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(12345), new TmfLongLocation(123456L), 0);
         long found = fCheckpointCollection.binarySearch(checkpoint);
         assertEquals(0, found);
 
-        fCheckpointCollection.insert(new TmfCheckpoint(new TmfTimestamp(12345 + 1), new TmfLongLocation(123456L + 1), 1));
+        fCheckpointCollection.insert(new TmfCheckpoint(TmfTimestamp.fromSeconds(12345 + 1), new TmfLongLocation(123456L + 1), 1));
         assertEquals(2, fCheckpointCollection.size());
 
         fCheckpointCollection.dispose();
@@ -438,7 +438,7 @@ public abstract class AbstractCheckpointCollectionTest {
     public void testInsertAfterEmptyReopen() {
         fCheckpointCollection.dispose();
         fCheckpointCollection = createCollection();
-        fCheckpointCollection.insert(new TmfCheckpoint(new TmfTimestamp(12345), new TmfLongLocation(123456L), 0));
+        fCheckpointCollection.insert(new TmfCheckpoint(TmfTimestamp.fromSeconds(12345), new TmfLongLocation(123456L), 0));
         assertEquals(1, fCheckpointCollection.size());
     }
 }
index 24aa14253df57bf1406035c1854fb85357355b43..a6d30741fae99fb36457a2d5614fd802e8cd6669 100644 (file)
@@ -152,7 +152,7 @@ public class AllBench {
             long old = System.currentTimeMillis();
             bTree = new BTree(BTREE_DEGREE, file, fTrace);
             for (int i = 0; i < checkpointsNum; i++) {
-                TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345 + i), new TmfLongLocation(123456L + i), i);
+                TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(12345 + i), new TmfLongLocation(123456L + i), i);
                 bTree.insert(checkpoint);
             }
 
@@ -177,7 +177,7 @@ public class AllBench {
             long old = System.currentTimeMillis();
             array = new FlatArray(file, fTrace);
             for (int i = 0; i < checkpointsNum; i++) {
-                TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345 + i), new TmfLongLocation(123456L + i), i);
+                TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(12345 + i), new TmfLongLocation(123456L + i), i);
                 array.insert(checkpoint);
             }
 
@@ -205,7 +205,7 @@ public class AllBench {
             bTree = new BTree(BTREE_DEGREE, file, fTrace);
             for (int i = 0; i < checkpointsNum; i++) {
                 Integer randomCheckpoint = list.get(i);
-                TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345 + randomCheckpoint), new TmfLongLocation(123456L + randomCheckpoint), 0);
+                TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(12345 + randomCheckpoint), new TmfLongLocation(123456L + randomCheckpoint), 0);
                 BTreeCheckpointVisitor treeVisitor = new BTreeCheckpointVisitor(checkpoint);
                 bTree.accept(treeVisitor);
                 assertEquals(randomCheckpoint.intValue(), treeVisitor.getCheckpoint().getCheckpointRank());
@@ -231,7 +231,7 @@ public class AllBench {
             array = new FlatArray(file, fTrace);
             for (int i = 0; i < checkpointsNum; i++) {
                 Integer randomCheckpoint = list.get(i);
-                TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345 + randomCheckpoint), new TmfLongLocation(123456L + randomCheckpoint), 0);
+                TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(12345 + randomCheckpoint), new TmfLongLocation(123456L + randomCheckpoint), 0);
                 long found = array.binarySearch(checkpoint);
                 assertEquals(randomCheckpoint.intValue(), found);
             }
index df4d697a0d4c330500755b916d3c96a792f81d44..02675ced1727043c340bd34067d01a72b04dbf72 100644 (file)
@@ -54,11 +54,11 @@ public class BTreeTest extends AbstractCheckpointCollectionTest {
     @Test
     public void testAccept() {
         for (int i = 0; i < CHECKPOINTS_INSERT_NUM; i++) {
-            TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(i), new TmfLongLocation(i), 0);
+            TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(i), new TmfLongLocation(i), 0);
             fBTree.insert(checkpoint);
         }
 
-        final TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(123), new TmfLongLocation(123L), 0);
+        final TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(123), new TmfLongLocation(123L), 0);
 
         class TestVisitor implements IBTreeVisitor {
             public int fLastCompare = 0;
@@ -93,7 +93,7 @@ public class BTreeTest extends AbstractCheckpointCollectionTest {
 
         for (int i = 0; i < CHECKPOINTS_INSERT_NUM; i++) {
             Integer checkpointIndex = list.get(i);
-            TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345 + checkpointIndex), new TmfLongLocation(123456L + checkpointIndex), 0);
+            TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(12345 + checkpointIndex), new TmfLongLocation(123456L + checkpointIndex), 0);
             BTreeCheckpointVisitor treeVisitor = new BTreeCheckpointVisitor(checkpoint);
             fBTree.accept(treeVisitor);
             assertEquals(checkpoint, treeVisitor.getCheckpoint());
index 4774586182b06e34937fd48b205df7e04995e534..13bec30017885762f295b44bc5f625b0e14f67c2 100644 (file)
@@ -51,11 +51,11 @@ public class FlatArrayTest extends AbstractCheckpointCollectionTest {
     @Test
     public void testBinarySearch() {
         for (long i = 0; i < CHECKPOINTS_INSERT_NUM; i++) {
-            TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(i), new TmfLongLocation(i), 0);
+            TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(i), new TmfLongLocation(i), 0);
             fFlatArray.insert(checkpoint);
         }
 
-        TmfCheckpoint expectedCheckpoint = new TmfCheckpoint(new TmfTimestamp(122), new TmfLongLocation(122L), 0);
+        TmfCheckpoint expectedCheckpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(122), new TmfLongLocation(122L), 0);
         int expectedRank = 122;
 
         long rank = fFlatArray.binarySearch(expectedCheckpoint);
@@ -77,7 +77,7 @@ public class FlatArrayTest extends AbstractCheckpointCollectionTest {
 
         for (int i = 0; i < CHECKPOINTS_INSERT_NUM; i++) {
             int checkpointIndex = list.get(i);
-            TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345 + checkpointIndex),
+            TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(12345 + checkpointIndex),
                     new TmfLongLocation(123456L + checkpointIndex), checkpointIndex);
             ITmfCheckpoint found = fFlatArray.get(checkpointIndex);
             assertEquals(checkpoint, found);
index 65c4a260650e0a431ae0b8003b0e3eb0bd0856d7..6c4ad43db88c0463882092331fc9a2b3699ec9ca 100644 (file)
@@ -43,7 +43,7 @@ public class TmfMemoryIndexTest extends AbstractCheckpointCollectionTest {
     @Override
     @Test
     public void testInsert() {
-        TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(12345), new TmfLongLocation(123456L), 0);
+        TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(12345), new TmfLongLocation(123456L), 0);
         fMemoryIndex.insert(checkpoint);
 
         ITmfCheckpoint indexCheckpoint = fMemoryIndex.get(0);
@@ -59,11 +59,11 @@ public class TmfMemoryIndexTest extends AbstractCheckpointCollectionTest {
     @Test
     public void testBinarySearch() {
         for (long i = 0; i < CHECKPOINTS_INSERT_NUM; i++) {
-            TmfCheckpoint checkpoint = new TmfCheckpoint(new TmfTimestamp(i), new TmfLongLocation(i), 0);
+            TmfCheckpoint checkpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(i), new TmfLongLocation(i), 0);
             fMemoryIndex.insert(checkpoint);
         }
 
-        TmfCheckpoint expectedCheckpoint = new TmfCheckpoint(new TmfTimestamp(122), new TmfLongLocation(122L), 0);
+        TmfCheckpoint expectedCheckpoint = new TmfCheckpoint(TmfTimestamp.fromSeconds(122), new TmfLongLocation(122L), 0);
         int expectedRank = 122;
 
         long rank = fMemoryIndex.binarySearch(expectedCheckpoint);
index a26ca09675997f1a586997f483633d96ff9c71e3..bffb1c6137d1d44edab39d3562f77020230a46fc 100644 (file)
@@ -29,6 +29,7 @@ import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.tracecompass.tmf.core.tests.TmfCoreTestPlugin;
 import org.eclipse.tracecompass.tmf.core.tests.shared.TmfTestTrace;
 import org.eclipse.tracecompass.tmf.core.tests.trace.indexer.checkpoint.AbstractIndexTest.ITestIndexer;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
@@ -178,7 +179,7 @@ public class TmfCheckpointIndexTest2 {
 
         // Verify that the event at rank=99 is returned when seeking to ts=101 (first event with this timestamp)
         // and not the event at checkpoint boundary
-        TmfTimestamp seekTs = new TmfTimestamp(101, -3);
+        ITmfTimestamp seekTs = TmfTimestamp.create(101, -3);
         ITmfContext ctx = fTrace.seekEvent(seekTs);
         ITmfEvent event = fTrace.getNext(ctx);
 
@@ -198,7 +199,7 @@ public class TmfCheckpointIndexTest2 {
         // Trace has events with same timestamp (ts=102) for ranks 102..702 -> 2 checkpoints with same timestamp are created
         // Verify that the event at rank=102 is returned when seeking to ts=102 (first event with this timestamp)
         // and not the event at checkpoint boundary
-        seekTs = new TmfTimestamp(102, -3);
+        seekTs = TmfTimestamp.create(102, -3);
         ctx = fTrace.seekEvent(seekTs);
         event = fTrace.getNext(ctx);
 
@@ -206,7 +207,7 @@ public class TmfCheckpointIndexTest2 {
         assertEquals(0, seekTs.compareTo(event.getTimestamp()));
 
         // Verify seek to first checkpoint
-        seekTs = new TmfTimestamp(1, -3);
+        seekTs = TmfTimestamp.create(1, -3);
         ctx = fTrace.seekEvent(seekTs);
         event = fTrace.getNext(ctx);
 
@@ -214,15 +215,15 @@ public class TmfCheckpointIndexTest2 {
         assertEquals(0, seekTs.compareTo(event.getTimestamp()));
 
         // Verify seek to timestamp before first event
-        seekTs = new TmfTimestamp(0, -3);
+        seekTs = TmfTimestamp.create(0, -3);
         ctx = fTrace.seekEvent(seekTs);
         event = fTrace.getNext(ctx);
 
         assertEquals(1, ctx.getRank());
-        assertEquals(0, new TmfTimestamp(1, -3).compareTo(event.getTimestamp()));
+        assertEquals(0, TmfTimestamp.create(1, -3).compareTo(event.getTimestamp()));
 
         // Verify seek to timestamp between first and second checkpoint
-        seekTs = new TmfTimestamp(50, -3);
+        seekTs = TmfTimestamp.create(50, -3);
         ctx = fTrace.seekEvent(seekTs);
         event = fTrace.getNext(ctx);
 
@@ -230,7 +231,7 @@ public class TmfCheckpointIndexTest2 {
         assertEquals(0, seekTs.compareTo(event.getTimestamp()));
 
         // Verify seek to timestamp after last event in trace
-        seekTs = new TmfTimestamp(103, -3);
+        seekTs = TmfTimestamp.create(103, -3);
         ctx = fTrace.seekEvent(seekTs);
         event = fTrace.getNext(ctx);
 
index f4c128619d21d1393d2137553dc4fc9da946add1..2491a4460bfd150d9f63bd9623d63a0c1ba9cef0 100644 (file)
@@ -37,7 +37,7 @@ public class TmfCheckpointTest {
     // Variables
     // ------------------------------------------------------------------------
 
-    private ITmfTimestamp fTimestamp1 = new TmfTimestamp();
+    private ITmfTimestamp fTimestamp1 = TmfTimestamp.fromSeconds(0);
     private ITmfTimestamp fTimestamp2 = TmfTimestamp.BIG_BANG;
     private ITmfTimestamp fTimestamp3 = TmfTimestamp.BIG_CRUNCH;
 
@@ -209,7 +209,7 @@ public class TmfCheckpointTest {
         assertFalse("equals", checkpoint1.equals(null));
 
         // Different types
-        assertFalse("equals", checkpoint1.equals(new TmfTimestamp()));
+        assertFalse("equals", checkpoint1.equals(TmfTimestamp.fromSeconds(0)));
 
         // Null locations/location
         assertFalse("equals", checkpoint1.equals(checkpoint4));
index ad18de40d9fa915f724f03dbe6efe8691b80b5ef..dd3af769436c2bdd9962694fc356208651f807da 100644 (file)
@@ -162,7 +162,7 @@ public class TmfExperimentCheckpointIndexTest {
         int pageSize = experiment.getCacheSize();
 
         // Build the first half of the index
-        TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(1, -3), new TmfTimestamp(NB_EVENTS / 2 - 1, -3));
+        TmfTimeRange range = new TmfTimeRange(TmfTimestamp.create(1, -3), TmfTimestamp.create(NB_EVENTS / 2 - 1, -3));
         experiment.getIndexer().buildIndex(0, range, true);
 
         // Validate that each checkpoint points to the right event
index 855fb12d326c53064dcd38e9cbe626420a332c97..91eae78b0a423115bc98045e623c96de6b6ac363 100644 (file)
@@ -23,6 +23,7 @@ import java.nio.ByteBuffer;
 
 import org.eclipse.tracecompass.internal.tmf.core.trace.experiment.TmfExperimentLocation;
 import org.eclipse.tracecompass.internal.tmf.core.trace.experiment.TmfLocationArray;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
 import org.eclipse.tracecompass.tmf.core.trace.location.TmfLocation;
@@ -42,7 +43,7 @@ public class TmfLocationTest {
     // ------------------------------------------------------------------------
 
     private Long aLong = 12345L;
-    private TmfTimestamp aTimestamp = new TmfTimestamp();
+    private ITmfTimestamp aTimestamp = TmfTimestamp.create(0, ITmfTimestamp.SECOND_SCALE);
     private TmfLocationArray aLocationArray;
 
     private TmfLongLocation fLocation1;
@@ -234,7 +235,7 @@ public class TmfLocationTest {
 
     @Test
     public void testToString() {
-        TmfTimestamp ts = new TmfTimestamp();
+        ITmfTimestamp ts = TmfTimestamp.create(0, ITmfTimestamp.SECOND_SCALE);
 
         TmfLongLocation location1 = new TmfLongLocation(aLong);
         TmfTimestampLocation location2 = new TmfTimestampLocation(ts);
index 739b398b75847752690106c8341a495e52dbfa95..38207c227af8de64e2da0ee80c44114480902c70 100644 (file)
@@ -128,7 +128,7 @@ public class TextTraceTest {
         assertEquals("getName",      "", trace.getName());
         assertEquals("getCacheSize", 100, trace.getCacheSize());
 
-        TmfTimestamp initRange = new TmfTimestamp(60, ITmfTimestamp.SECOND_SCALE);
+        ITmfTimestamp initRange = TmfTimestamp.fromSeconds(60);
         assertEquals("getInitialRangeOffset", initRange, trace.getInitialRangeOffset());
     }
 
@@ -177,7 +177,7 @@ public class TextTraceTest {
     public void testTraceIndexing() {
         assertEquals("getNbEvents", 6, fTrace.getNbEvents());
 
-        TmfTimestamp initRange = new TmfTimestamp(60, ITmfTimestamp.SECOND_SCALE);
+        ITmfTimestamp initRange = TmfTimestamp.fromSeconds(60);
         assertEquals("getInitialRangeOffset", initRange, fTrace.getInitialRangeOffset());
     }
 
index 5348c2b01b1bc5dc8f0ab357daff5380632497f6..f32fb23536f27f699a023a069d2ef85a4b93dd74 100644 (file)
@@ -23,6 +23,7 @@ import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.core.uml2sd.TmfAsyncSequenceDiagramEvent;
@@ -38,8 +39,8 @@ public class TmfAsyncSequenceDiagramEventTest {
     private final String fLabel1  = "label2";
     private final String[] fLabels  = new String[] { fLabel0, fLabel1 };
 
-    private final TmfTimestamp fTimestamp1 = new TmfTimestamp(12345, (byte) 2);
-    private final TmfTimestamp fTimestamp2 = new TmfTimestamp(12350, (byte) 2);
+    private final ITmfTimestamp fTimestamp1 = TmfTimestamp.create(12345, (byte) 2);
+    private final ITmfTimestamp fTimestamp2 = TmfTimestamp.create(12350, (byte) 2);
     private final TmfEventType fType       = new TmfEventType(fTypeId, TmfEventField.makeRoot(fLabels));
 
     private final ITmfEvent fEvent1;
index 476c6cae83fd35784d07e598a6f7a5f588576f98..ee4e4236793c54780f7c03fff3cf063da0364395 100644 (file)
@@ -23,6 +23,7 @@ import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.core.uml2sd.TmfSyncSequenceDiagramEvent;
@@ -38,7 +39,7 @@ public class TmfSyncSequenceDiagramEventTest {
     private final @NonNull String fLabel1  = "label2";
     private final String[] fLabels  = new String[] { fLabel0, fLabel1 };
 
-    private final TmfTimestamp fTimestamp1 = new TmfTimestamp(12345, (byte) 2);
+    private final ITmfTimestamp fTimestamp1 = TmfTimestamp.create(12345, (byte) 2);
     private final TmfEventType fType       = new TmfEventType(fTypeId, TmfEventField.makeRoot(fLabels));
 
     private final ITmfEvent fEvent1;
index aeb5cf695cb322b86b17bbb7a9f803447c9611a3..332d29e5b7e62cea76654e36d14fdadebb3db1bd 100644 (file)
@@ -22,8 +22,8 @@ import org.eclipse.tracecompass.tmf.core.component.ITmfEventProvider;
 import org.eclipse.tracecompass.tmf.core.component.TmfEventProvider;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
 import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
 import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest.ExecutionType;
+import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.core.trace.TmfContext;
index a3e4d47e56adc1fb66b142aa6571f9677432a411..f1adf8ed5c239f4ee72aad8c0c95e1814a1b598c 100644 (file)
@@ -340,7 +340,7 @@ public class TmfTraceStub extends TmfTrace implements ITmfPersistentlyIndexable
 
     @Override
     public ITmfTimestamp createTimestamp(long ts) {
-        return new TmfTimestamp(getTimestampTransform().transform(ts) / 1000000L, ITmfTimestamp.MILLISECOND_SCALE);
+        return TmfTimestamp.fromMillis(getTimestampTransform().transform(ts) / 1000000L);
     }
 
     @Override
@@ -397,7 +397,7 @@ public class TmfTraceStub extends TmfTrace implements ITmfPersistentlyIndexable
     @Override
     public synchronized int getCheckpointSize() {
         if (fCheckpointSize == -1) {
-            TmfCheckpoint c = new TmfCheckpoint(new TmfTimestamp(0L), new TmfLongLocation(0L), 0);
+            TmfCheckpoint c = new TmfCheckpoint(TmfTimestamp.fromSeconds(0L), new TmfLongLocation(0L), 0);
             ByteBuffer b = ByteBuffer.allocate(ITmfCheckpoint.MAX_SERIALIZE_SIZE);
             b.clear();
             c.serialize(b);
index b5df50009e44bd28ce30b56a2f8c8a21321550ec..58b126aaa1d7419824e6495c13974983a9ab8425 100644 (file)
@@ -105,7 +105,7 @@ public class SyslogTrace extends TextTrace<SyslogEvent> {
                 timestamp = createTimestamp(ns);
             }
         } catch (ParseException e) {
-            timestamp = new TmfTimestamp();
+            timestamp = TmfTimestamp.create(0, ITmfTimestamp.SECOND_SCALE);
         }
 
         TextTraceEventContent content = new TextTraceEventContent(5);
@@ -136,7 +136,7 @@ public class SyslogTrace extends TextTrace<SyslogEvent> {
 
     @Override
     public ITmfTimestamp getInitialRangeOffset() {
-        return new TmfTimestamp(60, ITmfTimestamp.SECOND_SCALE);
+        return TmfTimestamp.fromSeconds(60);
     }
 
     @Override
index ccb079d1a7961902dc2c19d5773b2515f76e8047..b2bb7a3fbd82e24ef230c51d7b1e2b5464f521a3 100644 (file)
@@ -52,7 +52,7 @@ import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTrace;
 import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTraceDefinition;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
 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.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.core.trace.TmfContext;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
@@ -315,7 +315,7 @@ public class TmfXmlTraceStub extends TmfTrace {
          * original is in second and we need to convert it. We should do that at
          * the source when it is supported
          */
-        ITmfTimestamp timestamp = new TmfNanoTimestamp(event.getTimestamp().getValue() / SECONDS_TO_NS);
+        ITmfTimestamp timestamp = TmfTimestamp.fromNanos(event.getTimestamp().getValue() / SECONDS_TO_NS);
         TmfEvent newEvent = new TmfEvent(this, ITmfContext.UNKNOWN_RANK, timestamp, eventType, eventFields);
         updateAttributes(savedContext, event);
         return newEvent;
index 474226858aa181a0fd60f08166034fd355daffdc..472ba6fc40118f0b9f91909fc535bacf463c1c4a 100644 (file)
@@ -39,7 +39,6 @@ import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
 import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
 import org.eclipse.tracecompass.tmf.core.statesystem.AbstractTmfStateProvider;
 import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
@@ -240,8 +239,8 @@ public class PartialHistoryBackend implements IStateHistoryBackend {
                  * caused by the event(s) happening exactly at 'checkpointTime',
                  * if any. We must not include those events in the query.
                  */
-                new TmfTimestamp(checkpointTime + 1, ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(t, ITmfTimestamp.NANOSECOND_SCALE));
+                TmfTimestamp.fromNanos(checkpointTime + 1),
+                TmfTimestamp.fromNanos(t));
         ITmfEventRequest request = new PartialStateSystemRequest(fPartialInput, range);
         fPartialInput.getTrace().sendRequest(request);
 
index 6ed717254bd6a1e56325a8e2bb1976861e5aea48..ef04ff4d4461db26f25c691e9b0a22b3e36bb634 100644 (file)
@@ -18,8 +18,8 @@ import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
-import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue.Type;
+import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
 
 /**
  * The average mipmap feature.
index da979b55170fa9426e06bf8f53aaf975c93dcc0b..dfa470ddbcd818fbd90d2a9503c905a9943ed5f5 100644 (file)
@@ -16,7 +16,6 @@ import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform;
 import org.eclipse.tracecompass.tmf.core.synchronization.TimestampTransformFactory;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 
 /**
  * Constant transform, just offset your timestamp with another.
@@ -56,7 +55,7 @@ public class TmfConstantTransform implements ITmfTimestampTransformInvertible {
      *            The offset of the linear transform
      */
     public TmfConstantTransform(@NonNull ITmfTimestamp offset) {
-        this(new TmfNanoTimestamp(offset).getValue());
+        this(offset.toNanos());
     }
 
     @Override
index a67f05feeae9228517f2eeaa760aaf5bbcf2059a..5f94d4cf3b02e83cc221a94814b063ef86aaee9e 100644 (file)
@@ -88,7 +88,7 @@ public class TmfTimestampTransformLinear implements ITmfTimestampTransformInvert
     @Override
     public ITmfTimestamp transform(ITmfTimestamp timestamp) {
         BigDecimal newvalue = BigDecimal.valueOf(timestamp.getValue()).multiply(fAlpha, fMc).add(fBeta);
-        return new TmfTimestamp(timestamp, newvalue.longValue());
+        return TmfTimestamp.create(newvalue.longValue(), timestamp.getScale());
     }
 
     @Override
index cfa4b5d066ea5ea87ff9a8cbb0c7eba0c53c923d..30531a60f6e921b6988d91bad7a688a821755d6b 100644 (file)
@@ -169,7 +169,7 @@ public class TmfTimestampTransformLinearFast implements ITmfTimestampTransformIn
 
     @Override
     public ITmfTimestamp transform(ITmfTimestamp timestamp) {
-        return new TmfTimestamp(timestamp, transform(timestamp.getValue()));
+        return TmfTimestamp.create(transform(timestamp.getValue()), timestamp.getScale());
     }
 
     @Override
index 1f4878df180c8dc5f046d14d566a96b2f72720f0..247d0693fabd612b4ba80dbb1443ec2b6b2f03e1 100644 (file)
@@ -82,7 +82,7 @@ public abstract class AbstractFileCheckpointCollection implements ICheckpointCol
             b.clear();
             fFileChannel.read(b);
             b.flip();
-            fTimeRange = new TmfTimeRange(new TmfTimestamp(b), new TmfTimestamp(b));
+            fTimeRange = new TmfTimeRange(TmfTimestamp.create(b), TmfTimestamp.create(b));
         }
 
         /**
@@ -112,8 +112,8 @@ public abstract class AbstractFileCheckpointCollection implements ICheckpointCol
 
             ByteBuffer b = ByteBuffer.allocate(MAX_TIME_RANGE_SERIALIZE_SIZE);
             b.clear();
-            new TmfTimestamp(fTimeRange.getStartTime()).serialize(b);
-            new TmfTimestamp(fTimeRange.getEndTime()).serialize(b);
+            TmfTimestamp.serialize(b, fTimeRange.getStartTime());
+            TmfTimestamp.serialize(b, fTimeRange.getEndTime());
             b.rewind();
             fFileChannel.write(b);
         }
index d8645864054f7fe1e0e8004c0b935cac7713ceba..6dc910fb7d7175243a4ff18163122f6803db293d 100644 (file)
@@ -113,7 +113,7 @@ class BTreeNode {
             for (int i = 0; i < fNumEntries; ++i) {
 
                 ITmfLocation location = fTree.getTrace().restoreLocation(bb);
-                ITmfTimestamp timeStamp = new TmfTimestamp(bb);
+                ITmfTimestamp timeStamp = TmfTimestamp.create(bb);
                 TmfCheckpoint c = new TmfCheckpoint(timeStamp, location, bb);
                 fEntries[i] = c;
             }
index 64bfa085bb8a12ae22bce786c2d186b919d76ac0..ffe3da9ccf9eb63ce39a858f7aa48c20eabc9697 100644 (file)
@@ -94,7 +94,7 @@ public class FlatArray extends AbstractFileCheckpointCollection {
             fByteBuffer.clear();
             getRandomAccessFile().read(fByteBuffer.array());
             ITmfLocation location = getTrace().restoreLocation(fByteBuffer);
-            ITmfTimestamp timeStamp = new TmfTimestamp(fByteBuffer);
+            ITmfTimestamp timeStamp = TmfTimestamp.create(fByteBuffer);
             checkpoint = new TmfCheckpoint(timeStamp, location, fByteBuffer);
         } catch (IOException e) {
             Activator.logError(MessageFormat.format(Messages.FlatArray_IOErrorReading, getFile()), e);
index 8b6ae8b51dec93345f34a17c6b78afeb518936f5..2d18d80b3026d0ab1a3f807adf91f862b62ff628 100644 (file)
@@ -19,7 +19,7 @@ import java.util.List;
 
 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.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampFormat;
 
 /**
@@ -212,7 +212,7 @@ public class TmfFilterCompareNode extends TmfFilterAspectNode {
             return (ITmfTimestamp) value;
         }
         try {
-            return new TmfNanoTimestamp(fTimestampFormat.parseValue(value.toString()));
+            return TmfTimestamp.fromNanos(fTimestampFormat.parseValue(value.toString()));
         } catch (ParseException e) {
         }
         return null;
index 6d55a9664a6d1865980cd29f609a6d8d2441a97f..14333459bd210309d89a56ee01a7e715e419791a 100644 (file)
@@ -26,7 +26,6 @@ import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
 import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition.OutputColumn;
 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.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampFormat;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
@@ -220,12 +219,12 @@ public class CustomEvent extends TmfEvent {
     private void processData() {
         String timestampString = fData.get(CustomTraceDefinition.TAG_TIMESTAMP);
         String timestampInputFormat = fData.get(TIMESTAMP_INPUT_FORMAT_KEY);
-        TmfTimestamp timestamp = null;
+        ITmfTimestamp timestamp = null;
         if (timestampInputFormat != null && timestampString != null) {
             TmfTimestampFormat timestampFormat = new TmfTimestampFormat(timestampInputFormat);
             try {
                 long time = timestampFormat.parseValue(timestampString);
-                timestamp = new TmfNanoTimestamp(getTrace().getTimestampTransform().transform(time));
+                timestamp = TmfTimestamp.fromNanos(getTrace().getTimestampTransform().transform(time));
                 setTimestamp(timestamp);
             } catch (ParseException e) {
                 setTimestamp(TmfTimestamp.ZERO);
index 31c411338a69eeac216adf9a1fedf4d4b917a30e..6c1215184a6286005a0c65a05d6c2a46db6fe1d4 100644 (file)
@@ -114,8 +114,8 @@ public class TmfEventsStatistics implements ITmfStatistics {
 
     @Override
     public long getEventsInRange(long start, long end) {
-        ITmfTimestamp startTS = new TmfTimestamp(start, SCALE);
-        ITmfTimestamp endTS = new TmfTimestamp(end, SCALE);
+        ITmfTimestamp startTS = TmfTimestamp.create(start, SCALE);
+        ITmfTimestamp endTS = TmfTimestamp.create(end, SCALE);
         TmfTimeRange range = new TmfTimeRange(startTS, endTS);
 
         StatsTotalRequest request = new StatsTotalRequest(trace, range);
@@ -127,8 +127,8 @@ public class TmfEventsStatistics implements ITmfStatistics {
 
     @Override
     public Map<String, Long> getEventTypesInRange(long start, long end) {
-        ITmfTimestamp startTS = new TmfTimestamp(start, SCALE);
-        ITmfTimestamp endTS = new TmfTimestamp(end, SCALE);
+        ITmfTimestamp startTS = TmfTimestamp.create(start, SCALE);
+        ITmfTimestamp endTS = TmfTimestamp.create(end, SCALE);
         TmfTimeRange range = new TmfTimeRange(startTS, endTS);
 
         StatsPerTypeRequest request = new StatsPerTypeRequest(trace, range);
@@ -247,8 +247,8 @@ public class TmfEventsStatistics implements ITmfStatistics {
         public HistogramQueryRequest(long[] borders, long endTime) {
             super(trace.getEventType(),
                     new TmfTimeRange(
-                            new TmfTimestamp(borders[0], SCALE),
-                            new TmfTimestamp(endTime, SCALE)),
+                            TmfTimestamp.create(borders[0], SCALE),
+                            TmfTimestamp.create(endTime, SCALE)),
                     0,
                     ITmfEventRequest.ALL_DATA,
                     ITmfEventRequest.ExecutionType.BACKGROUND);
index 150ba09e83fc98e553c0fdda282dbca7eb9e63c8..49ea7b197058ab3e8db68c2cb6267e41f3f5d6ee 100644 (file)
@@ -16,7 +16,9 @@ package org.eclipse.tracecompass.tmf.core.timestamp;
 /**
  * A simplified timestamp where scale is nanoseconds and precision is set to 0.
  */
-public class TmfNanoTimestamp extends TmfTimestamp {
+public final class TmfNanoTimestamp extends TmfTimestamp {
+
+    private final long fValue;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -36,20 +38,18 @@ public class TmfNanoTimestamp extends TmfTimestamp {
      *            the timestamp value
      */
     public TmfNanoTimestamp(final long value) {
-        super(value, ITmfTimestamp.NANOSECOND_SCALE);
+        fValue = value;
     }
 
-    /**
-     * Copy constructor.
-     *
-     * If the parameter is not a TmfNanoTimestamp, the timestamp will be scaled
-     * to nanoseconds, and the precision will be discarded.
-     *
-     * @param timestamp
-     *            The timestamp to copy
-     */
-    public TmfNanoTimestamp(final ITmfTimestamp timestamp) {
-        super(timestamp.toNanos(), ITmfTimestamp.NANOSECOND_SCALE);
+    @Override
+    public long getValue() {
+        return fValue;
+    }
+
+
+    @Override
+    public int getScale() {
+        return ITmfTimestamp.NANOSECOND_SCALE;
     }
 
     // ------------------------------------------------------------------------
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfRealTimestamp.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfRealTimestamp.java
new file mode 100644 (file)
index 0000000..e0ee9e0
--- /dev/null
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.core.timestamp;
+
+/**
+ * A timestamp with a user provided scale and value
+ *
+ * @author Matthew Khouzam
+ * @since 2.0
+ */
+public class TmfRealTimestamp extends TmfTimestamp {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    /**
+     * The timestamp raw value (mantissa)
+     */
+    private final long fValue;
+
+    /**
+     * The timestamp scale (magnitude)
+     */
+    private final int fScale;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Full constructor
+     *
+     * @param value
+     *            the timestamp value
+     * @param scale
+     *            the timestamp scale
+     */
+    public TmfRealTimestamp(final long value, final int scale) {
+        fValue = value;
+        fScale = scale;
+    }
+
+    @Override
+    public long getValue() {
+        return fValue;
+    }
+
+    @Override
+    public int getScale() {
+        return fScale;
+    }
+}
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
new file mode 100644 (file)
index 0000000..8c5b573
--- /dev/null
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * 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;
+    }
+
+    // ------------------------------------------------------------------------
+    // ITmfTimestamp
+    // ------------------------------------------------------------------------
+
+    @Override
+    public ITmfTimestamp normalize(final long offset, final int scale) {
+        if (scale == ITmfTimestamp.SECOND_SCALE) {
+            return TmfTimestamp.fromSeconds(saturatedAdd(getValue(), offset));
+        }
+        return super.normalize(offset, scale);
+    }
+
+    @Override
+    public int compareTo(final ITmfTimestamp ts) {
+        if (ts instanceof TmfSecondTimestamp) {
+            final long delta = getValue() - ts.getValue();
+            return (delta == 0) ? 0 : (delta > 0) ? 1 : -1;
+        }
+        return super.compareTo(ts);
+    }
+
+    @Override
+    public ITmfTimestamp getDelta(final ITmfTimestamp ts) {
+        if (ts instanceof TmfSecondTimestamp) {
+            return new TmfTimestampDelta(getValue() - ts.getValue());
+        }
+        return super.getDelta(ts);
+    }
+
+    // ------------------------------------------------------------------------
+    // Object
+    // ------------------------------------------------------------------------
+
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
+
+    @Override
+    public boolean equals(final Object other) {
+        if (this == other) {
+            return true;
+        }
+        if (other == null) {
+            return false;
+        }
+        if (!(other instanceof TmfSecondTimestamp)) {
+            return super.equals(other);
+        }
+        final TmfSecondTimestamp ts = (TmfSecondTimestamp) other;
+
+        return compareTo(ts) == 0;
+    }
+
+}
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfSimpleTimestamp.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfSimpleTimestamp.java
deleted file mode 100644 (file)
index 78cce97..0000000
+++ /dev/null
@@ -1,110 +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
- */
-public class TmfSimpleTimestamp extends TmfTimestamp {
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Default constructor (value = 0)
-     */
-    public TmfSimpleTimestamp() {
-        this(0);
-    }
-
-    /**
-     * Full constructor
-     *
-     * @param value the timestamp value
-     */
-    public TmfSimpleTimestamp(final long value) {
-        super(value, 0);
-    }
-
-    /**
-     * Copy constructor.
-     *
-     * If the parameter is not a TmfSimpleTimestamp, the timestamp will be
-     * scaled to seconds, and the precision will be discarded.
-     *
-     * @param timestamp
-     *            The timestamp to copy
-     */
-    public TmfSimpleTimestamp(final ITmfTimestamp timestamp) {
-        super(timestamp.normalize(0, ITmfTimestamp.SECOND_SCALE).getValue(), 0);
-    }
-
-    // ------------------------------------------------------------------------
-    // ITmfTimestamp
-    // ------------------------------------------------------------------------
-
-    @Override
-    public ITmfTimestamp normalize(final long offset, final int scale) {
-        if (scale == ITmfTimestamp.SECOND_SCALE) {
-            return new TmfSimpleTimestamp(saturatedAdd(getValue(), offset));
-        }
-        return super.normalize(offset, scale);
-    }
-
-    @Override
-    public int compareTo(final ITmfTimestamp ts) {
-        if (ts instanceof TmfSimpleTimestamp) {
-            final long delta = getValue() - ts.getValue();
-            return (delta == 0) ? 0 : (delta > 0) ? 1 : -1;
-        }
-        return super.compareTo(ts);
-    }
-
-    @Override
-    public ITmfTimestamp getDelta(final ITmfTimestamp ts) {
-        if (ts instanceof TmfSimpleTimestamp) {
-            return new TmfTimestampDelta(getValue() - ts.getValue());
-        }
-        return super.getDelta(ts);
-    }
-
-    // ------------------------------------------------------------------------
-    // Object
-    // ------------------------------------------------------------------------
-
-    @Override
-    public int hashCode() {
-        return super.hashCode();
-    }
-
-    @Override
-    public boolean equals(final Object other) {
-        if (this == other) {
-            return true;
-        }
-        if (other == null) {
-            return false;
-        }
-        if (!(other instanceof TmfSimpleTimestamp)) {
-            return super.equals(other);
-        }
-        final TmfSimpleTimestamp ts = (TmfSimpleTimestamp) other;
-
-        return compareTo(ts) == 0;
-    }
-
-}
index e1102ded77683aeb02fc3106785d885d9a36313a..a12eb9d9d31d7e10fe1d8689152f0349a3df5387 100644 (file)
@@ -21,134 +21,140 @@ import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * A generic timestamp implementation. The timestamp is represented by the tuple
- * { value, scale, precision }. By default, timestamps are scaled in seconds.
+ * { value, scale, precision }.
  *
  * @author Francois Chouinard
  */
-public class TmfTimestamp implements ITmfTimestamp {
-
-    // ------------------------------------------------------------------------
-    // Constants
-    // ------------------------------------------------------------------------
-
+public abstract class TmfTimestamp implements ITmfTimestamp {
     /**
-     * The beginning of time
-     */
-    public static final @NonNull ITmfTimestamp BIG_BANG = new TmfTimestamp(Long.MIN_VALUE, Integer.MAX_VALUE);
-
-    /**
-     * The end of time
-     */
-    public static final @NonNull ITmfTimestamp BIG_CRUNCH = new TmfTimestamp(Long.MAX_VALUE, Integer.MAX_VALUE);
-
-    /**
-     * Zero
-     */
-    public static final @NonNull ITmfTimestamp ZERO = new TmfTimestamp(0, 0);
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    /**
-     * The timestamp raw value (mantissa)
+     * Create a timestamp.
+     *
+     * @param value
+     *            the value in nanoseconds
+     * @return the timestamp
+     * @since 2.0
      */
-    private final long fValue;
+    public static @NonNull ITmfTimestamp fromNanos(long value) {
+        return new TmfNanoTimestamp(value);
+    }
 
     /**
-     * The timestamp scale (magnitude)
+     * Create a timestamp.
+     *
+     * @param value
+     *            the value in microseconds
+     * @return the timestamp
+     * @since 2.0
      */
-    private final int fScale;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
+    public static @NonNull ITmfTimestamp fromMicros(long value) {
+        return create(value, ITmfTimestamp.MICROSECOND_SCALE);
+    }
 
     /**
-     * Default constructor
+     * Create a timestamp.
+     *
+     * @param value
+     *            the value in milliseconds
+     * @return the timestamp
+     * @since 2.0
      */
-    public TmfTimestamp() {
-        this(0, ITmfTimestamp.SECOND_SCALE);
+    public static @NonNull ITmfTimestamp fromMillis(long value) {
+        return create(value, ITmfTimestamp.MILLISECOND_SCALE);
     }
 
     /**
-     * Simple constructor (scale = 0)
+     * Create a timestamp.
      *
      * @param value
-     *            the timestamp value
+     *            the value in seconds
+     * @return the timestamp
+     * @since 2.0
      */
-    public TmfTimestamp(final long value) {
-        this(value, ITmfTimestamp.SECOND_SCALE);
+    public static @NonNull ITmfTimestamp fromSeconds(long value) {
+        return new TmfSecondTimestamp(value);
     }
 
     /**
-     * Full constructor
+     * Create a timestamp.
      *
-     * @param value
-     *            the timestamp value
-     * @param scale
-     *            the timestamp scale
+     * @param bufferIn
+     *            the byte buffer to read the timestamp from.
+     * @return the timestamp
+     * @since 2.0
      */
-    public TmfTimestamp(final long value, final int scale) {
-        fValue = value;
-        fScale = scale;
+    public static @NonNull ITmfTimestamp create(ByteBuffer bufferIn) {
+        return create(bufferIn.getLong(), bufferIn.getInt());
     }
 
     /**
-     * Copy constructor
+     * Create a timestamp.
      *
-     * @param timestamp
-     *            the timestamp to copy
+     * @param value
+     *            the value in time, the unit is specified by the scale
+     * @param scale
+     *            the scale of the timestamp with respect to seconds, so a
+     *            nanosecond would be -9 (10e-9) and a megasecond would be 6
+     *            (10e6)
+     * @return the timestamp
+     * @since 2.0
      */
-    public TmfTimestamp(final ITmfTimestamp timestamp) {
-        if (timestamp == null) {
-            throw new IllegalArgumentException();
+    public static @NonNull ITmfTimestamp create(long value, int scale) {
+        if (scale == ITmfTimestamp.NANOSECOND_SCALE) {
+            return fromNanos(value);
         }
-        fValue = timestamp.getValue();
-        fScale = timestamp.getScale();
+        if (scale == ITmfTimestamp.SECOND_SCALE) {
+            return fromSeconds(value);
+        }
+        return createOther(value, scale);
     }
 
     /**
-     * Copies a timestamp but with a new time value
+     * Write the time stamp to the ByteBuffer so that it can be saved to disk.
      *
-     * @param timestamp
-     *            The timestamp to copy
-     * @param newvalue
-     *            The value the new timestamp will have
+     * @param bufferOut
+     *            the buffer to write to
+     * @param ts
+     *            the timestamp to write
+     * @since 2.0
      */
-    public TmfTimestamp(ITmfTimestamp timestamp, long newvalue) {
-        if (timestamp == null) {
-            throw new IllegalArgumentException();
-        }
-        fValue = newvalue;
-        fScale = timestamp.getScale();
+    public static void serialize(ByteBuffer bufferOut, ITmfTimestamp ts) {
+        bufferOut.putLong(ts.getValue());
+        bufferOut.putInt(ts.getScale());
+    }
+
+    private static @NonNull ITmfTimestamp createOther(long value, int scale) {
+        return new TmfRealTimestamp(value, scale);
     }
 
     // ------------------------------------------------------------------------
-    // ITmfTimestamp
+    // Constants
     // ------------------------------------------------------------------------
 
     /**
-     * Construct the timestamp from the ByteBuffer.
-     *
-     * @param bufferIn
-     *            the buffer to read from
+     * The beginning of time
      */
-    public TmfTimestamp(ByteBuffer bufferIn) {
-        this(bufferIn.getLong(), bufferIn.getInt());
-    }
+    public static final @NonNull ITmfTimestamp BIG_BANG = new TmfRealTimestamp(Long.MIN_VALUE, Integer.MAX_VALUE);
 
-    @Override
-    public long getValue() {
-        return fValue;
-    }
+    /**
+     * The end of time
+     */
+    public static final @NonNull ITmfTimestamp BIG_CRUNCH = new TmfRealTimestamp(Long.MAX_VALUE, Integer.MAX_VALUE);
 
-    @Override
-    public int getScale() {
-        return fScale;
-    }
+    /**
+     * Zero
+     */
+    public static final @NonNull ITmfTimestamp ZERO = new TmfRealTimestamp(0, 0);
+
+    // ------------------------------------------------------------------------
+    // ITmfTimestamp
+    // ------------------------------------------------------------------------
 
-    private static final long scalingFactors[] = new long[] {
+    /**
+     * Scaling factors to help scale
+     *
+     * @since 2.0
+     */
+    protected static final long SCALING_FACTORS[] = new long[] {
             1L,
             10L,
             100L,
@@ -187,20 +193,20 @@ public class TmfTimestamp implements ITmfTimestamp {
         }
 
         if (value == 0) {
-            return new TmfTimestamp(offset, scale);
+            return create(offset, scale);
         }
 
         // First, scale the timestamp
         if (getScale() != scale) {
             final int scaleDiff = Math.abs(getScale() - scale);
-            if (scaleDiff >= scalingFactors.length) {
+            if (scaleDiff >= SCALING_FACTORS.length) {
                 if (getScale() < scale) {
                     value = 0;
                 } else {
                     value = value > 0 ? Long.MAX_VALUE : Long.MIN_VALUE;
                 }
             } else {
-                final long scalingFactor = scalingFactors[scaleDiff];
+                final long scalingFactor = SCALING_FACTORS[scaleDiff];
                 if (getScale() < scale) {
                     value /= scalingFactor;
                 } else {
@@ -211,14 +217,15 @@ public class TmfTimestamp implements ITmfTimestamp {
 
         value = saturatedAdd(value, offset);
 
-        return new TmfTimestamp(value, scale);
+        return create(value, scale);
     }
 
     @Override
     public ITmfTimestamp getDelta(final ITmfTimestamp ts) {
-        final ITmfTimestamp nts = ts.normalize(0, fScale);
-        final long value = fValue - nts.getValue();
-        return new TmfTimestampDelta(value, fScale);
+        final int scale = getScale();
+        final ITmfTimestamp nts = ts.normalize(0, scale);
+        final long value = getValue() - nts.getValue();
+        return new TmfTimestampDelta(value, scale);
     }
 
     @Override
@@ -236,41 +243,43 @@ public class TmfTimestamp implements ITmfTimestamp {
 
     @Override
     public int compareTo(final ITmfTimestamp ts) {
+        long value = getValue();
+        int scale = getScale();
         // Check the corner cases (we can't use equals() because it uses
         // compareTo()...)
         if (ts == null) {
             return 1;
         }
-        if (this == ts || (fValue == ts.getValue() && fScale == ts.getScale())) {
+        if (this == ts || (value == ts.getValue() && scale == ts.getScale())) {
             return 0;
         }
-        if ((fValue == BIG_BANG.getValue() && fScale == BIG_BANG.getScale()) || (ts.getValue() == BIG_CRUNCH.getValue() && ts.getScale() == BIG_CRUNCH.getScale())) {
+        if ((value == BIG_BANG.getValue() && scale == BIG_BANG.getScale()) || (ts.getValue() == BIG_CRUNCH.getValue() && ts.getScale() == BIG_CRUNCH.getScale())) {
             return -1;
         }
-        if ((fValue == BIG_CRUNCH.getValue() && fScale == BIG_CRUNCH.getScale()) || (ts.getValue() == BIG_BANG.getValue() && ts.getScale() == BIG_BANG.getScale())) {
+        if ((value == BIG_CRUNCH.getValue() && scale == BIG_CRUNCH.getScale()) || (ts.getValue() == BIG_BANG.getValue() && ts.getScale() == BIG_BANG.getScale())) {
             return 1;
         }
-        final ITmfTimestamp nts = ts.normalize(0, fScale);
+        final ITmfTimestamp nts = ts.normalize(0, scale);
         if ((nts.getValue() == 0 && ts.getValue() != 0) || (ts.getValue() != Long.MAX_VALUE && nts.getValue() == Long.MAX_VALUE) || (ts.getValue() != Long.MIN_VALUE && nts.getValue() == Long.MIN_VALUE)) {
             // Scaling error. We can figure it out nonetheless.
 
             // First, look at the sign of the mantissa
-            final long value = ts.getValue();
-            if (fValue == 0 && value == 0) {
+            final long otherValue = ts.getValue();
+            if (value == 0 && otherValue == 0) {
                 return 0;
             }
-            if (fValue < 0 && value >= 0) {
+            if (value < 0 && otherValue >= 0) {
                 return -1;
             }
-            if (fValue >= 0 && value < 0) {
+            if (value >= 0 && otherValue < 0) {
                 return 1;
             }
 
             // Otherwise, just compare the scales
-            final int scale = ts.getScale();
-            return (fScale > scale) ? (fValue >= 0) ? 1 : -1 : (fValue >= 0) ? -1 : 1;
+            final int otherScale = ts.getScale();
+            return (scale > otherScale) ? (otherValue >= 0) ? 1 : -1 : (otherValue >= 0) ? -1 : 1;
         }
-        final long delta = fValue - nts.getValue();
+        final long delta = value - nts.getValue();
         return Long.compare(delta, 0);
     }
 
@@ -332,8 +341,9 @@ public class TmfTimestamp implements ITmfTimestamp {
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result + (int) (fValue ^ (fValue >>> 32));
-        result = prime * result + fScale;
+        final long value = getValue();
+        result = prime * result + (int) (value ^ (value >>> 32));
+        result = prime * result + getScale();
         return result;
     }
 
@@ -366,15 +376,4 @@ public class TmfTimestamp implements ITmfTimestamp {
             return format.format(0);
         }
     }
-
-    /**
-     * Write the time stamp to the ByteBuffer so that it can be saved to disk.
-     *
-     * @param bufferOut
-     *            the buffer to write to
-     */
-    public void serialize(ByteBuffer bufferOut) {
-        bufferOut.putLong(fValue);
-        bufferOut.putInt(fScale);
-    }
 }
index af46693a395113d2f3a9e6eb2d4560c642629dd1..275bf233bb16ab2c7ecb2375b8f5bd499f41604c 100644 (file)
@@ -14,12 +14,12 @@ package org.eclipse.tracecompass.tmf.core.timestamp;
 import java.util.TimeZone;
 
 /**
- * A generic timestamp implementation for delta between timestamps.
- * The toString() method takes negative values into consideration.
+ * A generic timestamp implementation for delta between timestamps. The
+ * toString() method takes negative values into consideration.
  *
  * @author Bernd Hufmann
  */
-public class TmfTimestampDelta extends TmfTimestamp {
+public class TmfTimestampDelta extends TmfRealTimestamp {
 
     // ------------------------------------------------------------------------
     // Members
@@ -32,37 +32,40 @@ public class TmfTimestampDelta extends TmfTimestamp {
      * Default constructor
      */
     public TmfTimestampDelta() {
-        super();
+        super(0, ITmfTimestamp.SECOND_SCALE);
     }
 
     /**
      * Simple constructor (scale = precision = 0)
      *
-     * @param value the timestamp value
+     * @param value
+     *            the timestamp value
      */
 
     public TmfTimestampDelta(long value) {
-        super(value);
+        super(value, ITmfTimestamp.SECOND_SCALE);
     }
 
     /**
-     * Simple constructor (precision = 0)
+     * Constructor
      *
-     * @param value the timestamp value
-     * @param scale the timestamp scale
+     * @param value
+     *            the timestamp value
+     * @param scale
+     *            the timestamp scale
      */
     public TmfTimestampDelta(long value, int scale) {
         super(value, scale);
     }
 
-
     /**
      * Copy constructor
      *
-     * @param timestamp the timestamp to copy
+     * @param timestamp
+     *            the timestamp to copy
      */
     public TmfTimestampDelta(ITmfTimestamp timestamp) {
-        super(timestamp);
+        super(timestamp.getValue(), timestamp.getScale());
     }
 
     // ------------------------------------------------------------------------
index 8bdf031a4db06e30a19db736065563ecaedadae5..cb94d02547f929dff5bbc3114ad86455070a47e5 100644 (file)
@@ -51,7 +51,6 @@ import org.eclipse.tracecompass.tmf.core.signal.TmfTraceUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform;
 import org.eclipse.tracecompass.tmf.core.synchronization.TimestampTransformFactory;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
@@ -411,7 +410,7 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace, IT
     @Override
     public ITmfTimestamp getInitialRangeOffset() {
         final long DEFAULT_INITIAL_OFFSET_VALUE = (1L * 100 * 1000 * 1000); // .1sec
-        return new TmfTimestamp(DEFAULT_INITIAL_OFFSET_VALUE, ITmfTimestamp.NANOSECOND_SCALE);
+        return TmfTimestamp.fromNanos(DEFAULT_INITIAL_OFFSET_VALUE);
     }
 
     @Override
@@ -725,7 +724,7 @@ public abstract class TmfTrace extends TmfEventProvider implements ITmfTrace, IT
 
     @Override
     public @NonNull ITmfTimestamp createTimestamp(long ts) {
-        return new TmfNanoTimestamp(getTimestampTransform().transform(ts));
+        return TmfTimestamp.fromNanos(getTimestampTransform().transform(ts));
     }
 
     // ------------------------------------------------------------------------
index 137c7b9af75d75f374404888ac2b627ed7b7cf08..0d0a2124f2624be7a156b00f0f6ebe81d459a8a0 100644 (file)
@@ -285,7 +285,7 @@ public final class TmfTraceManager {
         long offset = trace.getInitialRangeOffset().toNanos();
         long endTime = startTs.toNanos() + offset;
         final TmfTimeRange selectionRange = new TmfTimeRange(startTs, startTs);
-        final TmfTimeRange windowRange = new TmfTimeRange(startTs, new TmfTimestamp(endTime, ITmfTimestamp.NANOSECOND_SCALE));
+        final TmfTimeRange windowRange = new TmfTimeRange(startTs, TmfTimestamp.fromNanos(endTime));
 
         final TmfTraceContext startCtx = trace.createTraceContext(selectionRange, windowRange, editorFile, null);
 
index efe3a552d395deea51604c641cb26d5aae48e5ef..0582179595f8f22fa39e3240c8eaa9f8b5b86402 100644 (file)
@@ -197,8 +197,7 @@ public class TmfCheckpoint implements ITmfCheckpoint {
         fLocation.serialize(bufferOut);
         // Always serialize as base TmfTimestamp, this should be sufficient for indexing.
         // If not, we can add API for the test to restore the time stamp, similarly to the location.
-        TmfTimestamp t = new TmfTimestamp(fTimestamp);
-        t.serialize(bufferOut);
+        TmfTimestamp.serialize(bufferOut, fTimestamp);
         bufferOut.putLong(fCheckpointRank);
     }
 
index 5ed344cd78de8d325c46f0ca08e6fafb7d19b49d..40a1deed1b6c7b6f4bfea63c16d9b57ba7d09bc3 100644 (file)
@@ -49,7 +49,7 @@ public final class TmfTimestampLocation extends TmfLocation {
      *            the buffer to read from
      */
     public TmfTimestampLocation(ByteBuffer bufferIn) {
-        super(new TmfTimestamp(bufferIn));
+        super(TmfTimestamp.create(bufferIn));
     }
 
     @Override
@@ -59,7 +59,6 @@ public final class TmfTimestampLocation extends TmfLocation {
 
     @Override
     public void serialize(ByteBuffer bufferOut) {
-        TmfTimestamp t = new TmfTimestamp(getLocationInfo());
-        t.serialize(bufferOut);
+        TmfTimestamp.serialize(bufferOut, getLocationInfo());
     }
 }
index d5e053cbeadb3b6cdcc78497f4b4988462baa25e..c60398198f5c1593370075955a87c3f8de58b19b 100644 (file)
@@ -13,9 +13,9 @@
 package org.eclipse.tracecompass.tmf.remote.core.tests.shell;
 
 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-import static org.junit.Assume.assumeTrue;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
 
 import java.util.Arrays;
 
index a66f168d74a8548a09b148c93ad8c80ce6cde1c1..ad2c036968399712220efc26831646020c09a3c8 100644 (file)
@@ -19,7 +19,6 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
@@ -589,13 +588,13 @@ public class HistogramDataModelTest {
         countEventsInModel(nbEvents, model);
 
         final TmfTimeRange timeRange_0 = new TmfTimeRange(
-                new TmfTimestamp(5L, ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(10L, ITmfTimestamp.NANOSECOND_SCALE));
+                TmfTimestamp.fromNanos(5L),
+                TmfTimestamp.fromNanos(10L));
         model.countLostEvent(timeRange_0, nbLostEvents_0, false);
 
         final TmfTimeRange timeRange_1 = new TmfTimeRange(
-                new TmfTimestamp(18L, ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(27L, ITmfTimestamp.NANOSECOND_SCALE));
+                TmfTimestamp.fromNanos(18L),
+                TmfTimestamp.fromNanos(27L));
         model.countLostEvent(timeRange_1, nbLostEvents_1, false);
 
         HistogramScaledData result = model.scaleTo(nbBuckets, maxHeight, 1);
@@ -625,13 +624,13 @@ public class HistogramDataModelTest {
         countEventsInModel(nbEvents, model);
 
         final TmfTimeRange timeRange_0 = new TmfTimeRange(
-                new TmfTimestamp(5L, ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(10L, ITmfTimestamp.NANOSECOND_SCALE));
+                TmfTimestamp.fromNanos(5L),
+                TmfTimestamp.fromNanos(10L));
         model.countLostEvent(timeRange_0, nbLostEvents_0, false);
 
         final TmfTimeRange timeRange_1 = new TmfTimeRange(
-                new TmfTimestamp(11L, ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(18L, ITmfTimestamp.NANOSECOND_SCALE));
+                TmfTimestamp.fromNanos(11L),
+                TmfTimestamp.fromNanos(18L));
         model.countLostEvent(timeRange_1, nbLostEvents_1, false);
 
         HistogramScaledData result = model.scaleTo(nbBuckets, maxHeight, 1);
@@ -660,18 +659,18 @@ public class HistogramDataModelTest {
         countEventsInModel(nbEvents, model);
 
         final TmfTimeRange timeRange_0 = new TmfTimeRange(
-                new TmfTimestamp(18L, ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(22L, ITmfTimestamp.NANOSECOND_SCALE));
+                TmfTimestamp.fromNanos(18L),
+                TmfTimestamp.fromNanos(22L));
         model.countLostEvent(timeRange_0, nbLostEvents_0, false);
 
         final TmfTimeRange timeRange_2 = new TmfTimeRange(
-                new TmfTimestamp(28L, ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(29L, ITmfTimestamp.NANOSECOND_SCALE));
+                TmfTimestamp.fromNanos(28L),
+                TmfTimestamp.fromNanos(29L));
         model.countLostEvent(timeRange_2, nbLostEvents_2, false);
 
         final TmfTimeRange timeRange_1 = new TmfTimeRange(
-                new TmfTimestamp(11L, ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(26L, ITmfTimestamp.NANOSECOND_SCALE));
+                TmfTimestamp.fromNanos(11L),
+                TmfTimestamp.fromNanos(26L));
         model.countLostEvent(timeRange_1, nbLostEvents_1, false);
 
         HistogramScaledData result = model.scaleTo(nbBuckets, maxHeight, 1);
@@ -698,8 +697,8 @@ public class HistogramDataModelTest {
         countEventsInModel(nbEvents, model);
 
         final TmfTimeRange timeRange_0 = new TmfTimeRange(
-                new TmfTimestamp(11L, ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(26L, ITmfTimestamp.NANOSECOND_SCALE));
+                TmfTimestamp.fromNanos(11L),
+                TmfTimestamp.fromNanos(26L));
         model.countLostEvent(timeRange_0, nbLostEvents_0, false);
 
         HistogramScaledData result = model.scaleTo(nbBuckets, maxHeight, 1);
@@ -727,16 +726,16 @@ public class HistogramDataModelTest {
         HistogramDataModel model = new HistogramDataModel(nbBuckets);
 
         final TmfTimeRange timeRange_0 = new TmfTimeRange(
-                new TmfTimestamp(5L, ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(10L, ITmfTimestamp.NANOSECOND_SCALE));
+                TmfTimestamp.fromNanos(5L),
+                TmfTimestamp.fromNanos(10L));
         model.countLostEvent(timeRange_0, nbLostEvents_0, false);
 
         int firstNonLostEventTime = 6;
         countEventsInModel(nbEvents, model, 0, firstNonLostEventTime);
 
         final TmfTimeRange timeRange_1 = new TmfTimeRange(
-                new TmfTimestamp(18L, ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(27L, ITmfTimestamp.NANOSECOND_SCALE));
+                TmfTimestamp.fromNanos(18L),
+                TmfTimestamp.fromNanos(27L));
         model.countLostEvent(timeRange_1, nbLostEvents_1, false);
 
         HistogramScaledData result = model.scaleTo(nbBuckets, maxHeight, 1);
index 959a07fe680fcb4ad455c736d094f43e34aefd71..5c63c538ecf7c7458c9d81805c592d3b524dbfd3 100644 (file)
@@ -26,15 +26,16 @@ import org.eclipse.jface.viewers.ColumnLabelProvider;
 import org.eclipse.jface.viewers.ViewerComparator;
 import org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.model.Messages;
 import org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.model.TmfBaseColumnData;
+import org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
 import org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.model.TmfBaseColumnDataProvider;
 import org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.model.TmfStatisticsTree;
 import org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.model.TmfStatisticsTreeNode;
-import org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.junit.Test;
@@ -66,9 +67,9 @@ public class TmfBaseColumnDataProviderTest {
     private final String fLabel2 = "label3";
     private final String[] fLabels = new String[] { fLabel0, fLabel1, fLabel2 };
 
-    private final TmfTimestamp fTimestamp1 = new TmfTimestamp(12345, (byte) 2);
-    private final TmfTimestamp fTimestamp2 = new TmfTimestamp(12350, (byte) 2);
-    private final TmfTimestamp fTimestamp3 = new TmfTimestamp(12355, (byte) 2);
+    private final ITmfTimestamp fTimestamp1 = TmfTimestamp.create(12345, (byte) 2);
+    private final ITmfTimestamp fTimestamp2 = TmfTimestamp.create(12350, (byte) 2);
+    private final ITmfTimestamp fTimestamp3 = TmfTimestamp.create(12355, (byte) 2);
 
     private final TmfEventType fType1 = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels));
     private final TmfEventType fType2 = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels));
index 82046b6891a3d31b751c8c6672e98a5dfcfab685..63e280b06576fe8bcffa8963fc310347b0c9ce69 100755 (executable)
@@ -22,9 +22,9 @@ import org.eclipse.jface.viewers.ViewerComparator;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.model.TmfBaseColumnData;
+import org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
 import org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.model.TmfStatisticsTree;
 import org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.model.TmfStatisticsTreeNode;
-import org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
 import org.eclipse.ui.ISharedImages;
 import org.eclipse.ui.PlatformUI;
 import org.junit.Before;
index 4328b2c2c5a37134efcafab933977c241e708b78..668fb17f46452509225074e4eb0d9fbeb2e6485e 100755 (executable)
@@ -34,6 +34,7 @@ import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.junit.Test;
@@ -57,9 +58,9 @@ public class TmfBaseStatisticsDataTest {
     private final String   fLabel2 = "label3";
     private final String[] fLabels = new String[] { fLabel0, fLabel1, fLabel2 };
 
-    private final TmfTimestamp fTimestamp1 = new TmfTimestamp(12345, (byte) 2);
-    private final TmfTimestamp fTimestamp2 = new TmfTimestamp(12350, (byte) 2);
-    private final TmfTimestamp fTimestamp3 = new TmfTimestamp(12355, (byte) 2);
+    private final ITmfTimestamp fTimestamp1 = TmfTimestamp.create(12345, (byte) 2);
+    private final ITmfTimestamp fTimestamp2 = TmfTimestamp.create(12350, (byte) 2);
+    private final ITmfTimestamp fTimestamp3 = TmfTimestamp.create(12355, (byte) 2);
 
     private final TmfEventType fType1 = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels));
     private final TmfEventType fType2 = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels));
index fa9f73cf9c754a4ce28c64fb50c52434dfe41ffb..737598826a4d8afb9cc41eb3fd5db5a054d3bb98 100755 (executable)
@@ -32,6 +32,7 @@ import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
 import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.junit.Test;
@@ -54,8 +55,8 @@ public class TmfTreeContentProviderTest {
     private final String fLabel1 = "label2";
     private final String[] fLabels = new String[] { fLabel0, fLabel1 };
 
-    private final TmfTimestamp fTimestamp1 = new TmfTimestamp(12345, (byte) 2);
-    private final TmfTimestamp fTimestamp2 = new TmfTimestamp(12350, (byte) 2);
+    private final ITmfTimestamp fTimestamp1 = TmfTimestamp.create(12345, (byte) 2);
+    private final ITmfTimestamp fTimestamp2 = TmfTimestamp.create(12350, (byte) 2);
 
     private final TmfEventType fType1 = new TmfEventType(fTypeId1, TmfEventField.makeRoot(fLabels));
     private final TmfEventType fType2 = new TmfEventType(fTypeId2, TmfEventField.makeRoot(fLabels));
index aa427bf3f374560df004d07d8eddf193f80f5940..fa93e0f0bb776a916cbd8f743a930a84ba8a0737 100644 (file)
@@ -11,8 +11,8 @@
  *******************************************************************************/
 package org.eclipse.tracecompass.tmf.ui.tests.views.uml2sd.loader;
 
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 
 /**
  *  Interface for testing signal handling within TmfUml2SD
@@ -83,12 +83,12 @@ public interface IUml2SdSignalValidator {
     /**
      * @return the expected current time.
      */
-    TmfTimestamp getCurrentTime();
+    ITmfTimestamp getCurrentTime();
     /**
      * Sets the expected current time
      * @param currentTime Time to set
      */
-    void setCurrentTime(TmfTimestamp currentTime);
+    void setCurrentTime(ITmfTimestamp currentTime);
 
     /**
      * @return the expected current time range.
index 1ae4b6df1db554008ac63093ac25d0832f6bca23..242933b13da3dd5a955d6ec187bef7e7dc61a333 100644 (file)
@@ -18,8 +18,8 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.ui.views.uml2sd.core.GraphNode;
index 741fa9d1d6fa06e144a1e4c75475bf7f18eb2928..059c1d2074e74b6ca7d50622fb1aea778a32062f 100644 (file)
@@ -21,8 +21,8 @@ import static org.junit.Assert.assertTrue;
 import java.util.List;
 
 import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.ui.views.uml2sd.core.GraphNode;
index 32fab5fb18f5ee78da37213fc6fa2a1277088550..3982ea448bf0bb15f41543a994e91b3dd726b693 100644 (file)
@@ -14,12 +14,12 @@ package org.eclipse.tracecompass.tmf.ui.tests.views.uml2sd.loader;
 
 import org.eclipse.tracecompass.tmf.core.component.TmfComponent;
 import org.eclipse.tracecompass.tmf.core.signal.TmfEndSynchSignal;
-import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfStartSynchSignal;
-import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 
 /**
  *  Class to implement that certain signals are sent as well as are sent with correct content.
@@ -39,7 +39,7 @@ public class Uml2SDSignalValidator extends TmfComponent implements IUml2SdSignal
     private boolean fIsRangeError = false;
 
     private Object fSource = null;
-    private TmfTimestamp fCurrentTimestamp = null;
+    private ITmfTimestamp fCurrentTimestamp = null;
     private TmfTimeRange fCurrentTimeRange = null;
 
     // ------------------------------------------------------------------------
@@ -166,13 +166,13 @@ public class Uml2SDSignalValidator extends TmfComponent implements IUml2SdSignal
     }
 
     @Override
-    public TmfTimestamp getCurrentTime() {
+    public ITmfTimestamp getCurrentTime() {
         return fCurrentTimestamp;
     }
 
     @Override
-    public void setCurrentTime(TmfTimestamp currentTime) {
-        fCurrentTimestamp = currentTime == null ? null : new TmfTimestamp(currentTime);
+    public void setCurrentTime(ITmfTimestamp currentTime) {
+        fCurrentTimestamp = currentTime;
     }
 
     @Override
index 04c060d7a1bc51f8dddbbe3648ef614fdb65685f..c9fa64b294d94055402224a8a09e51375fb6af50 100644 (file)
@@ -20,10 +20,14 @@ import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
  *
  */
 public class Uml2SDTestTimestamp extends TmfTimestamp {
+
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
 
+    private final long fValue;
+    private final int fScale;
+
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
@@ -33,11 +37,22 @@ public class Uml2SDTestTimestamp extends TmfTimestamp {
      * @param value time as long value (nanoseconds)
      */
     public Uml2SDTestTimestamp(long value) {
-        super(value, IUml2SDTestConstants.TIME_SCALE);
+        fValue = value;
+        fScale = IUml2SDTestConstants.TIME_SCALE;
     }
 
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
 
+    @Override
+    public long getValue() {
+        return fValue;
+    }
+
+    @Override
+    public int getScale() {
+        return fScale;
+    }
+
 }
index ddea688608451b4641091b4aedb22ffa4ec6aab2..e1ec9bf7c058120c475ec170e2b5c3e6f86c9e65 100644 (file)
@@ -151,7 +151,7 @@ public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterPro
 //                else if (i == 6)
 //                    m3.setTime(new TmfTimestamp(i));
 //                else
-                    m3.setTime(new TmfTimestamp(i + 1));
+                    m3.setTime(TmfTimestamp.fromSeconds(i + 1));
             }
 
             for (int i = testFrame.lifeLinesCount() - 1; i > 0; i--) {
@@ -189,8 +189,8 @@ public class TestLoaders implements IUml2SDLoader, ISDFindProvider, ISDFilterPro
             m.setEndLifeline(testFrame.getLifeline(3));
             m.setStartOccurrence(2);
             m.setEndOccurrence(6);
-            m.setStartTime(new TmfTimestamp(2));
-            m.setEndTime(new TmfTimestamp(6));
+            m.setStartTime(TmfTimestamp.fromSeconds(2));
+            m.setEndTime(TmfTimestamp.fromSeconds(6));
             m.setName("*******************Async TEST ****************");
             testFrame.addMessage(m);
             v.setFrame(testFrame);
index 92c1a62311b5c9f357e9361a22ebd27fb2bb3326..3fb0d956304e6f420cc992d52bc9b1b5e89ed44c 100644 (file)
@@ -100,7 +100,7 @@ public class TmfUml2SDTestTrace implements ITmfEventParser {
             fields[2] = new TmfEventField("signal", signal, null);
 
             ITmfEventField tmfContent = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, content, fields);
-            ITmfEvent tmfEvent = new TmfEvent(fEventStream, ITmfContext.UNKNOWN_RANK, new TmfTimestamp(ts, -9), tmfEventType, tmfContent);
+            ITmfEvent tmfEvent = new TmfEvent(fEventStream, ITmfContext.UNKNOWN_RANK, TmfTimestamp.create(ts, -9), tmfEventType, tmfContent);
 
             return tmfEvent;
         } catch (final EOFException e) {
index 20c25fb1764d7ad1052abc69afd3e58f41da547f..d349a2f40349e14f0e76417b17d735ed13fb2857 100644 (file)
@@ -12,8 +12,8 @@
 
 package org.eclipse.tracecompass.internal.tmf.ui.markers;
 
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.eclipse.tracecompass.tmf.core.trace.AbstractTmfTraceAdapterFactory;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.IMarkerEventSource;
 
 /**
index a9f966710ce462a25e64cd85a81c6712e02dcdeb..61325a1afe3d4774281ba85442d68513196e1bb0 100644 (file)
@@ -75,10 +75,10 @@ import org.eclipse.swt.widgets.Text;
 import org.eclipse.tracecompass.internal.tmf.ui.Activator;
 import org.eclipse.tracecompass.internal.tmf.ui.Messages;
 import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlInputAttribute;
 import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlInputElement;
 import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTrace;
 import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTraceDefinition;
-import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlInputAttribute;
 import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceType;
 import org.eclipse.tracecompass.tmf.core.project.model.TraceTypeHelper;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampFormat;
index 838dd48ce4c02ec11d7031c60b08d62e0f87b484..adcdadfe0cf9e206de3103e7558b7beda449dfbb 100644 (file)
@@ -56,12 +56,12 @@ import org.eclipse.swt.widgets.Tree;
 import org.eclipse.swt.widgets.TreeColumn;
 import org.eclipse.swt.widgets.TreeItem;
 import org.eclipse.tracecompass.tmf.core.signal.TmfEventSelectedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
-import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
 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.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampFormat;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
@@ -80,8 +80,8 @@ import org.eclipse.ui.dialogs.PatternFilter;
 public class OffsetDialog extends Dialog {
 
     private static final int TREE_EDITOR_MIN_WIDTH = 50;
-    private static final String EDITOR_KEY = "$editor$";  //$NON-NLS-1$
-    private static final String WIDTH_KEY = "$width$";  //$NON-NLS-1$
+    private static final String EDITOR_KEY = "$editor$"; //$NON-NLS-1$
+    private static final String WIDTH_KEY = "$width$"; //$NON-NLS-1$
 
     private static final TmfTimestampFormat TIME_FORMAT = new TmfTimestampFormat("yyyy-MM-dd HH:mm:ss.SSS SSS SSS"); //$NON-NLS-1$
     private static final TmfTimestampFormat OFFSET_FORMAT = new TmfTimestampFormat("T.SSS SSS SSS"); //$NON-NLS-1$
@@ -138,7 +138,7 @@ public class OffsetDialog extends Dialog {
                         ITmfTimestamp refTime = map.get(element);
                         long ref = refTime == null ? 0 : refTime.toNanos();
                         Long newVal = TIME_FORMAT.parseValue(string, ref);
-                        map.put((TmfTraceElement) element, new TmfNanoTimestamp(newVal));
+                        map.put((TmfTraceElement) element, TmfTimestamp.fromNanos(newVal));
                     } catch (ParseException e) {
                         /* Ignore and reload previous value */
                     }
@@ -314,11 +314,11 @@ public class OffsetDialog extends Dialog {
         // Define the TableViewer
         fViewer = new FilteredTree(parent, SWT.MULTI | SWT.H_SCROLL
                 | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER, new PatternFilter() {
-            @Override
-            protected boolean isLeafMatch(Viewer viewer, Object element) {
-                return wordMatches(((TmfTraceElement) element).getElementPath());
-            }
-        }, true);
+                    @Override
+                    protected boolean isLeafMatch(Viewer viewer, Object element) {
+                        return wordMatches(((TmfTraceElement) element).getElementPath());
+                    }
+                }, true);
 
         // Make lines and make header visible
         final Tree tree = fViewer.getViewer().getTree();
@@ -421,8 +421,8 @@ public class OffsetDialog extends Dialog {
                     ITmfTimestamp targetTime = fTargetTimeMap.get(traceElement);
                     ITmfTimestamp refTime = fRefTimeMap.get(traceElement);
                     if (targetTime != null && refTime != null) {
-                        long offset = new TmfNanoTimestamp(targetTime).getValue() -
-                                new TmfNanoTimestamp(refTime).getValue();
+                        long offset = targetTime.toNanos() -
+                                refTime.toNanos();
                         fOffsetMap.put(traceElement, offset);
                         fViewer.getViewer().update(traceElement, null);
                     }
@@ -435,8 +435,8 @@ public class OffsetDialog extends Dialog {
         }
 
         /* put temporary values in maps to pack according to time formats */
-        fRefTimeMap.put(traces.get(0), new TmfNanoTimestamp());
-        fTargetTimeMap.put(traces.get(0), new TmfNanoTimestamp());
+        fRefTimeMap.put(traces.get(0), TmfTimestamp.fromNanos(0));
+        fTargetTimeMap.put(traces.get(0), TmfTimestamp.fromNanos(0));
         fViewer.getViewer().update(traces.get(0), null);
         for (final TreeColumn treeColumn : tree.getColumns()) {
             if (treeColumn.getResizable()) {
@@ -495,7 +495,7 @@ public class OffsetDialog extends Dialog {
         fRefTimeColumn.setWidth(0);
         fRefTimeColumn.setResizable(false);
         fButtonViewerColumn.getColumn().setWidth(0);
-        fAdvancedMessageLabel.setText("");  //$NON-NLS-1$
+        fAdvancedMessageLabel.setText(""); //$NON-NLS-1$
     }
 
     private void setAdvancedMode() {
index 6c5a6372e47c2d30fb92d5fa49008578bf2c0524..7de2ca6bcb9f811abaf40546de00caff8ff6e994 100644 (file)
@@ -18,9 +18,9 @@ import java.util.List;
 import java.util.Timer;
 import java.util.TimerTask;
 
-import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
+import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
index b8d4754374f785c05500a05c83c8be4ae1f94efc..08d0bf567b47f5f5bd66238fe9d324fc1f13a3bd 100644 (file)
@@ -214,8 +214,8 @@ public abstract class TmfTimeViewer extends TmfViewer implements ITmfTimeProvide
         if (fTrace != null) {
             setSelectionRange(currentBeginTime, currentEndTime);
 
-            final ITmfTimestamp startTimestamp = new TmfTimestamp(getSelectionBeginTime(), ITmfTimestamp.NANOSECOND_SCALE);
-            final ITmfTimestamp endTimestamp = new TmfTimestamp(getSelectionEndTime(), ITmfTimestamp.NANOSECOND_SCALE);
+            final ITmfTimestamp startTimestamp = TmfTimestamp.fromNanos(getSelectionBeginTime());
+            final ITmfTimestamp endTimestamp = TmfTimestamp.fromNanos(getSelectionEndTime());
 
             TmfSelectionRangeUpdatedSignal signal = new TmfSelectionRangeUpdatedSignal(this, startTimestamp, endTimestamp);
             broadcast(signal);
@@ -229,8 +229,8 @@ public abstract class TmfTimeViewer extends TmfViewer implements ITmfTimeProvide
 
         // Build the new time range; keep the current time
         TmfTimeRange timeRange = new TmfTimeRange(
-                new TmfTimestamp(getWindowStartTime(), ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(getWindowEndTime(), ITmfTimestamp.NANOSECOND_SCALE));
+                TmfTimestamp.fromNanos(getWindowStartTime()),
+                TmfTimestamp.fromNanos(getWindowEndTime()));
 
         // Send the signal
         TmfWindowRangeUpdatedSignal signal = new TmfWindowRangeUpdatedSignal(this, timeRange);
index 12299f726d41824708525b91f9bff9406abfc5b1..c62b70d720b0442bdcbe30b426fc4b3800fcb082 100644 (file)
@@ -152,7 +152,6 @@ import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
@@ -233,8 +232,8 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
 
     private final class ColumnMovedListener extends ControlAdapter {
         /*
-         * Make sure that the margin column is always first and keep the
-         * column order variable up to date.
+         * Make sure that the margin column is always first and keep the column
+         * order variable up to date.
          */
         @Override
         public void controlMoved(ControlEvent e) {
@@ -460,13 +459,12 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
             GC gc = event.gc;
             Color background = item.getBackground(event.index);
             /*
-             * Paint the background if it is not the default system color.
-             * In Windows, if you let the widget draw the background, it
-             * will not show the item's background color if the item is
-             * selected or hot. If there are no style ranges and the item
-             * background is the default system color, we do not want to
-             * paint it or otherwise we would override the platform theme
-             * (e.g. alternating colors).
+             * Paint the background if it is not the default system color. In
+             * Windows, if you let the widget draw the background, it will not
+             * show the item's background color if the item is selected or hot.
+             * If there are no style ranges and the item background is the
+             * default system color, we do not want to paint it or otherwise we
+             * would override the platform theme (e.g. alternating colors).
              */
             if (styleRanges != null || !background.equals(item.getParent().getBackground())) {
                 // we will paint the table item's background
@@ -479,9 +477,9 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
 
             /*
              * We will paint the table item's foreground. In Windows, if you
-             * paint the background but let the widget draw the foreground,
-             * it will override your background, unless the item is selected
-             * or hot.
+             * paint the background but let the widget draw the foreground, it
+             * will override your background, unless the item is selected or
+             * hot.
              */
             event.detail &= ~SWT.FOREGROUND;
 
@@ -556,8 +554,8 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
                 /*
                  * Bug in Linux. The coordinates of the event have an origin
                  * that excludes the table header but the method toDisplay()
-                 * expects coordinates relative to an origin that includes
-                 * the table header.
+                 * expects coordinates relative to an origin that includes the
+                 * table header.
                  */
                 int y = event.y;
                 if (IS_LINUX) {
@@ -590,8 +588,8 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
      * The events table search/filter/data keys
      *
      * @author Patrick Tasse
-     * @noimplement This interface only contains Event Table specific
-     *              static definitions.
+     * @noimplement This interface only contains Event Table specific static
+     *              definitions.
      */
     public interface Key {
 
@@ -1559,7 +1557,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
         }
         item.setText(itemStrings);
         item.setData(tmfEvent);
-        item.setData(Key.TIMESTAMP, new TmfTimestamp(tmfEvent.getTimestamp()));
+        item.setData(Key.TIMESTAMP, tmfEvent.getTimestamp());
         item.setData(Key.RANK, rank);
 
         final Collection<Long> markerIds = fBookmarksMap.get(rank);
@@ -2614,8 +2612,10 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
     /**
      * Returns true if the column is a visible event column.
      *
-     * @param column the column
-     * @return false if the column is the margin column or hidden, true otherwise
+     * @param column
+     *            the column
+     * @return false if the column is the margin column or hidden, true
+     *         otherwise
      */
     private static boolean isVisibleEventColumn(TableColumn column) {
         if (column.getData(Key.ASPECT) == TmfMarginColumn.MARGIN_ASPECT) {
@@ -2963,7 +2963,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
                                 bookmark.setAttribute(IMarker.MESSAGE, message.toString());
                                 bookmark.setAttribute(IMarker.LOCATION, location);
                                 bookmark.setAttribute(ITmfMarker.MARKER_RANK, rank.toString());
-                                bookmark.setAttribute(ITmfMarker.MARKER_TIME, Long.toString(new TmfNanoTimestamp(timestamp).getValue()));
+                                bookmark.setAttribute(ITmfMarker.MARKER_TIME, Long.toString(timestamp.toNanos()));
                                 bookmark.setAttribute(ITmfMarker.MARKER_COLOR, dialog.getColorValue().toString());
                                 id[0] = bookmark.getId();
                             }
@@ -3088,10 +3088,10 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
         try {
             String timeString = marker.getAttribute(ITmfMarker.MARKER_TIME, (String) null);
             long time = Long.parseLong(timeString);
-            tsBegin = new TmfNanoTimestamp(time);
+            tsBegin = TmfTimestamp.fromNanos(time);
             String durationString = marker.getAttribute(ITmfMarker.MARKER_DURATION, (String) null);
             long duration = Long.parseLong(durationString);
-            tsEnd = new TmfNanoTimestamp(time + duration);
+            tsEnd = TmfTimestamp.fromNanos(time + duration);
         } catch (NumberFormatException e) {
             /* ignored */
         }
@@ -3193,8 +3193,8 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
             final TmfEventRequest subRequest = new TmfEventRequest(ITmfEvent.class,
                     TmfTimeRange.ETERNITY, 0, 1, ExecutionType.FOREGROUND) {
 
-                TmfTimestamp ts = new TmfTimestamp(signal.getBeginTime());
-                TmfTimestamp tf = new TmfTimestamp(signal.getEndTime());
+                ITmfTimestamp ts = signal.getBeginTime();
+                ITmfTimestamp tf = signal.getEndTime();
 
                 @Override
                 public void handleSuccess() {
@@ -3245,7 +3245,10 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
                         contextEnd = fTrace.seekEvent(te);
                         rankEnd = contextEnd.getRank();
                         contextEnd.dispose();
-                        /* To include all events at the begin time, seek at the next nanosecond and then use the previous rank */
+                        /*
+                         * To include all events at the begin time, seek at the
+                         * next nanosecond and then use the previous rank
+                         */
                         tb = timestampBegin.normalize(1, ITmfTimestamp.NANOSECOND_SCALE);
                         if (tb.compareTo(fTrace.getEndTime()) <= 0) {
                             contextBegin = fTrace.seekEvent(tb);
@@ -3255,14 +3258,20 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
                             rankBegin = ITmfContext.UNKNOWN_RANK;
                         }
                         rankBegin = (rankBegin == ITmfContext.UNKNOWN_RANK ? fTrace.getNbEvents() : rankBegin) - 1;
-                        /* If no events in selection range, select only the next event */
+                        /*
+                         * If no events in selection range, select only the next
+                         * event
+                         */
                         rankBegin = rankBegin >= rankEnd ? rankBegin : rankEnd;
                     } else {
                         tb = timestampBegin;
                         contextBegin = fTrace.seekEvent(tb);
                         rankBegin = contextBegin.getRank();
                         contextBegin.dispose();
-                        /* To include all events at the end time, seek at the next nanosecond and then use the previous rank */
+                        /*
+                         * To include all events at the end time, seek at the
+                         * next nanosecond and then use the previous rank
+                         */
                         te = timestampEnd.normalize(1, ITmfTimestamp.NANOSECOND_SCALE);
                         if (te.compareTo(fTrace.getEndTime()) <= 0) {
                             contextEnd = fTrace.seekEvent(te);
@@ -3272,7 +3281,10 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
                             rankEnd = ITmfContext.UNKNOWN_RANK;
                         }
                         rankEnd = (rankEnd == ITmfContext.UNKNOWN_RANK ? fTrace.getNbEvents() : rankEnd) - 1;
-                        /* If no events in selection range, select only the next event */
+                        /*
+                         * If no events in selection range, select only the next
+                         * event
+                         */
                         rankEnd = rankEnd >= rankBegin ? rankEnd : rankBegin;
                     }
                     return new Pair<>(Long.valueOf(rankBegin), Long.valueOf(rankEnd));
index 7149790dcf3e325b9ee9b8aa859156a0690d87af..97fe501b6244e064145b9973a02a71f89df2bf06 100644 (file)
@@ -38,9 +38,9 @@ import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Tree;
 import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
-import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
+import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.eclipse.tracecompass.tmf.ui.viewers.TmfTimeViewer;
 
index 6e7bba9616e60d2819b8d00154c338f0028998fe..d838bf2a6925f6bac8c1598c26984d985e57476c 100644 (file)
@@ -20,7 +20,6 @@ import org.eclipse.swt.events.MouseTrackListener;
 import org.eclipse.swt.events.PaintEvent;
 import org.eclipse.swt.events.PaintListener;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.swtchart.IAxis;
 import org.swtchart.ISeries;
@@ -58,7 +57,7 @@ public class TmfClosestDataPointTooltipProvider extends TmfBaseProvider implemen
      * Constructor for a tool tip provider.
      *
      * @param tmfChartViewer
-     *                  - the parent chart viewer
+     *            - the parent chart viewer
      */
     public TmfClosestDataPointTooltipProvider(ITmfChartTimeProvider tmfChartViewer) {
         super(tmfChartViewer);
@@ -127,8 +126,8 @@ public class TmfClosestDataPointTooltipProvider extends TmfBaseProvider implemen
                     double currentDistance = xs * xs + ys * ys;
 
                     /*
-                     * Check for smallest distance to mouse position and
-                     * only consider it if the mouse is close the data point.
+                     * Check for smallest distance to mouse position and only
+                     * consider it if the mouse is close the data point.
                      */
                     if ((currentDistance < smallestDistance) && (currentDistance < (HIGHLIGHT_RADIUS * HIGHLIGHT_RADIUS))) {
                         smallestDistance = currentDistance;
@@ -144,15 +143,15 @@ public class TmfClosestDataPointTooltipProvider extends TmfBaseProvider implemen
             }
             String tooltip = null;
             if (param != null) {
-                 tooltip = createToolTipText(param);
+                tooltip = createToolTipText(param);
                 if (tooltip != null) {
                     fIsHighlight = true;
                     getChart().redraw();
                 }
             }
             /*
-             *  Note that tooltip might be null which will clear the
-             *  previous tooltip string. This is intentional.
+             * Note that tooltip might be null which will clear the previous
+             * tooltip string. This is intentional.
              */
             getChart().getPlotArea().setToolTipText(tooltip);
         }
@@ -202,7 +201,7 @@ public class TmfClosestDataPointTooltipProvider extends TmfBaseProvider implemen
             if ((xS != null) && (yS != null) && (dataIndex < xS.length) && (dataIndex < yS.length)) {
                 StringBuffer buffer = new StringBuffer();
                 buffer.append("x="); //$NON-NLS-1$
-                buffer.append(new TmfTimestamp((long) xS[dataIndex] + getChartViewer().getTimeOffset(), ITmfTimestamp.NANOSECOND_SCALE).toString());
+                buffer.append(TmfTimestamp.fromNanos((long) xS[dataIndex] + getChartViewer().getTimeOffset()).toString());
                 buffer.append('\n');
                 buffer.append("y="); //$NON-NLS-1$
                 buffer.append((long) yS[dataIndex]);
index fb82a4c3a1f7ef9946af57eacb5378c9c60f8d43..ad22dfb4911572554a0b5e7256d1a354f16a1fb9 100644 (file)
@@ -13,7 +13,6 @@ package org.eclipse.tracecompass.tmf.ui.viewers.xycharts;
 
 import org.eclipse.swt.events.MouseEvent;
 import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.swtchart.IAxis;
 
@@ -87,7 +86,7 @@ public class TmfSimpleTooltipProvider extends TmfBaseProvider implements MouseTr
         /* set tooltip of current data point */
         StringBuffer buffer = new StringBuffer();
         buffer.append("x="); //$NON-NLS-1$
-        buffer.append(new TmfTimestamp((long) xCoordinate + viewer.getTimeOffset(), ITmfTimestamp.NANOSECOND_SCALE).toString());
+        buffer.append(TmfTimestamp.fromNanos((long) xCoordinate + viewer.getTimeOffset()).toString());
         buffer.append("\n"); //$NON-NLS-1$
         buffer.append("y="); //$NON-NLS-1$
         buffer.append((long) yCoordinate);
index 6e5a51033b659343712c273790d88d69f12b3fbc..140944127fbc8832f46049a934fe899b74997f8c 100644 (file)
@@ -18,7 +18,6 @@ import org.eclipse.swt.events.MouseTrackListener;
 import org.eclipse.swt.events.PaintEvent;
 import org.eclipse.swt.events.PaintListener;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.ITmfChartTimeProvider;
 import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.TmfBaseProvider;
@@ -137,9 +136,9 @@ public class TmfHistogramTooltipProvider extends TmfBaseProvider implements Mous
             /* set tooltip of closest data point */
             StringBuffer buffer = new StringBuffer();
             buffer.append("Range=["); //$NON-NLS-1$
-            buffer.append(new TmfTimestamp((long) rangeStart + viewer.getTimeOffset(), ITmfTimestamp.NANOSECOND_SCALE).toString());
+            buffer.append(TmfTimestamp.fromNanos((long) rangeStart + viewer.getTimeOffset()).toString());
             buffer.append(',');
-            buffer.append(new TmfTimestamp((long) rangeEnd + viewer.getTimeOffset(), ITmfTimestamp.NANOSECOND_SCALE).toString());
+            buffer.append(TmfTimestamp.fromNanos((long) rangeEnd + viewer.getTimeOffset()).toString());
             buffer.append("]\n"); //$NON-NLS-1$
             buffer.append("y="); //$NON-NLS-1$
             buffer.append((long) y);
index e0667942ec7ac6e0a51ee58b95683cf0a98b9500..cf9f0bddce2c94f221c9fecca9d88da1dc9b20f0 100644 (file)
@@ -18,7 +18,6 @@ import java.text.ParsePosition;
 
 import org.eclipse.swt.events.MouseEvent;
 import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.ITmfChartTimeProvider;
 import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.TmfBaseProvider;
@@ -131,7 +130,7 @@ public class TmfCommonXLineChartTooltipProvider extends TmfBaseProvider implemen
             }
             StringBuffer buffer = new StringBuffer();
             buffer.append("time="); //$NON-NLS-1$
-            buffer.append(new TmfTimestamp((long) xCoordinate + getChartViewer().getTimeOffset(), ITmfTimestamp.NANOSECOND_SCALE).toString());
+            buffer.append(TmfTimestamp.fromNanos((long) xCoordinate + getChartViewer().getTimeOffset()).toString());
             buffer.append('\n');
 
             /* For each series, get the value at the index */
index 3e9bceedc0ef989136985cd85c221786e3c418dd..fe480fdb3e912be619eb63a8b751ab58bb37a435 100644 (file)
@@ -64,10 +64,9 @@ import org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampDelta;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
 import org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor;
@@ -303,10 +302,10 @@ public class CallStackView extends AbstractTimeGraphView {
                     int depth = entry.getStackLevel();
                     return Integer.toString(depth);
                 } else if (columnIndex == 2 && entry.getFunctionName().length() > 0) {
-                    ITmfTimestamp ts = new TmfTimestamp(entry.getFunctionEntryTime(), ITmfTimestamp.NANOSECOND_SCALE);
+                    ITmfTimestamp ts = TmfTimestamp.fromNanos(entry.getFunctionEntryTime());
                     return ts.toString();
                 } else if (columnIndex == 3 && entry.getFunctionName().length() > 0) {
-                    ITmfTimestamp ts = new TmfTimestamp(entry.getFunctionExitTime(), ITmfTimestamp.NANOSECOND_SCALE);
+                    ITmfTimestamp ts = TmfTimestamp.fromNanos(entry.getFunctionExitTime());
                     return ts.toString();
                 } else if (columnIndex == 4 && entry.getFunctionName().length() > 0) {
                     ITmfTimestamp ts = new TmfTimestampDelta(entry.getFunctionExitTime() - entry.getFunctionEntryTime(), ITmfTimestamp.NANOSECOND_SCALE);
@@ -385,7 +384,7 @@ public class CallStackView extends AbstractTimeGraphView {
                         long spacingTime = (long) ((exitTime - entryTime) * SPACING_RATIO);
                         entryTime -= spacingTime;
                         exitTime += spacingTime;
-                        TmfTimeRange range = new TmfTimeRange(new TmfNanoTimestamp(entryTime), new TmfNanoTimestamp(exitTime));
+                        TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromNanos(entryTime), TmfTimestamp.fromNanos(exitTime));
                         broadcast(new TmfWindowRangeUpdatedSignal(CallStackView.this, range));
                         getTimeGraphViewer().setStartFinishTime(entryTime, exitTime);
                         startZoomThread(entryTime, exitTime);
@@ -408,7 +407,7 @@ public class CallStackView extends AbstractTimeGraphView {
                         long spacingTime = (long) ((endTime - startTime) * SPACING_RATIO);
                         startTime -= spacingTime;
                         endTime += spacingTime;
-                        TmfTimeRange range = new TmfTimeRange(new TmfNanoTimestamp(startTime), new TmfNanoTimestamp(endTime));
+                        TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromNanos(startTime), TmfTimestamp.fromNanos(endTime));
                         broadcast(new TmfWindowRangeUpdatedSignal(CallStackView.this, range));
                         getTimeGraphViewer().setStartFinishTime(startTime, endTime);
                         startZoomThread(startTime, endTime);
index 210476b9661929ec454db93922240e95b0d3864a..a2bd470a93a361d1cde2597a463bc38355304628 100644 (file)
@@ -48,8 +48,8 @@ import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTimestampFormatUpdateSignal;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampDelta;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampFormat;
 import org.eclipse.tracecompass.tmf.ui.signal.TmfTimeViewAlignmentSignal;
 import org.eclipse.tracecompass.tmf.ui.views.ITmfTimeAligned;
@@ -1046,8 +1046,8 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
             buffer.append(newLine);
         }
         buffer.append(NLS.bind(Messages.Histogram_bucketRangeToolTip,
-                new TmfTimestamp(startTime, ITmfTimestamp.NANOSECOND_SCALE).toString(),
-                new TmfTimestamp(endTime, ITmfTimestamp.NANOSECOND_SCALE).toString()));
+                TmfTimestamp.fromNanos(startTime).toString(),
+                TmfTimestamp.fromNanos(endTime).toString()));
         buffer.append(newLine);
         buffer.append(NLS.bind(Messages.Histogram_eventCountToolTip, nbEvents));
         if (!HistogramScaledData.hideLostEvents) {
index dd65a53637841c0b1323f797568c77c8f9fca7c3..5f4acf5e3dd26f4a0ba0e6e7d6b2dc251bef0816 100644 (file)
@@ -20,7 +20,6 @@ import java.text.ParseException;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTimestampFormatUpdateSignal;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampFormat;
@@ -102,7 +101,7 @@ public class HistogramCurrentTimeControl extends HistogramTextControl {
     @Override
     public void setValue(long time) {
         if (time != Long.MIN_VALUE) {
-            super.setValue(time, new TmfTimestamp(time, ITmfTimestamp.NANOSECOND_SCALE).toString());
+            super.setValue(time, TmfTimestamp.fromNanos(time).toString());
         } else {
             super.setValue(time, ""); //$NON-NLS-1$
         }
index 025ea7b37010470dea27a6754d50fc400eb6ce05..eda7f2f87d995d64c503bc7ca9630d94340c3df9 100644 (file)
@@ -78,7 +78,7 @@ public class HistogramTimeRangeControl extends HistogramTextControl {
     @Override
     public void setValue(long time) {
         if (time != Long.MIN_VALUE) {
-            ITmfTimestamp ts = new TmfTimestamp(time, ITmfTimestamp.NANOSECOND_SCALE);
+            ITmfTimestamp ts = TmfTimestamp.fromNanos(time);
             super.setValue(time, ts.toString(TmfTimestampFormat.getDefaulIntervalFormat()));
         } else {
             super.setValue(time, ""); //$NON-NLS-1$
index 748e32ec83308a731d5c2fc89c9e169349533018..a580e02f4ab80781b3b541234c07e75ea9acb7e2 100644 (file)
@@ -474,8 +474,8 @@ public class HistogramView extends TmfView implements ITmfTimeAligned {
      */
     public TmfTimeRange getTimeRange() {
         return new TmfTimeRange(
-                new TmfTimestamp(fWindowStartTime, ITmfTimestamp.NANOSECOND_SCALE),
-                new TmfTimestamp(fWindowEndTime, ITmfTimestamp.NANOSECOND_SCALE));
+                TmfTimestamp.fromNanos(fWindowStartTime),
+                TmfTimestamp.fromNanos(fWindowEndTime));
     }
 
     /**
@@ -539,8 +539,8 @@ public class HistogramView extends TmfView implements ITmfTimeAligned {
      */
     void updateSelectionTime(long beginTime, long endTime) {
         updateDisplayedSelectionTime(beginTime, endTime);
-        TmfTimestamp beginTs = new TmfTimestamp(beginTime, ITmfTimestamp.NANOSECOND_SCALE);
-        TmfTimestamp endTs = new TmfTimestamp(endTime, ITmfTimestamp.NANOSECOND_SCALE);
+        ITmfTimestamp beginTs = TmfTimestamp.fromNanos(beginTime);
+        ITmfTimestamp endTs = TmfTimestamp.fromNanos(endTime);
         TmfSelectionRangeUpdatedSignal signal = new TmfSelectionRangeUpdatedSignal(this, beginTs, endTs);
         fTimeSyncThrottle.queue(signal);
     }
@@ -578,8 +578,8 @@ public class HistogramView extends TmfView implements ITmfTimeAligned {
         if (fTrace != null) {
             // Build the new time range; keep the current time
             TmfTimeRange timeRange = new TmfTimeRange(
-                    new TmfTimestamp(startTime, ITmfTimestamp.NANOSECOND_SCALE),
-                    new TmfTimestamp(endTime, ITmfTimestamp.NANOSECOND_SCALE));
+                    TmfTimestamp.fromNanos(startTime),
+                    TmfTimestamp.fromNanos(endTime));
             fTimeSpanControl.setValue(endTime - startTime);
 
             updateDisplayedTimeRange(startTime, endTime);
@@ -937,8 +937,8 @@ public class HistogramView extends TmfView implements ITmfTimeAligned {
         if ((fTimeRangeRequest != null) && !fTimeRangeRequest.isCompleted()) {
             fTimeRangeRequest.cancel();
         }
-        TmfTimestamp startTS = new TmfTimestamp(startTime, ITmfTimestamp.NANOSECOND_SCALE);
-        TmfTimestamp endTS = new TmfTimestamp(endTime, ITmfTimestamp.NANOSECOND_SCALE);
+        ITmfTimestamp startTS = TmfTimestamp.fromNanos(startTime);
+        ITmfTimestamp endTS = TmfTimestamp.fromNanos(endTime);
         TmfTimeRange timeRange = new TmfTimeRange(startTS, endTS);
 
         fTimeRangeHistogram.clear();
index 067cfb7aa07fb99a3159ed0a5279c7d12cc43e3b..edda1f7f514c8b58f8bb29a7efa8fa490b6cc032 100644 (file)
@@ -265,8 +265,8 @@ public class TmfStateSystemViewer extends AbstractTmfTreeViewer {
                                 !interval.getStateValue().isNull();
                     stateEntry = new StateEntry(ss.getAttributeName(quark), quark, ss.getFullAttributePath(quark),
                             interval.getStateValue(),
-                            new TmfTimestamp(interval.getStartTime(), ITmfTimestamp.NANOSECOND_SCALE),
-                            new TmfTimestamp(interval.getEndTime(), ITmfTimestamp.NANOSECOND_SCALE),
+                            TmfTimestamp.fromNanos(interval.getStartTime()),
+                            TmfTimestamp.fromNanos(interval.getEndTime()),
                             modified);
 
                     // update children first to know if parent is really needed
@@ -283,8 +283,8 @@ public class TmfStateSystemViewer extends AbstractTmfTreeViewer {
                     }
                 } else {
                     stateEntry.update(interval.getStateValue(),
-                            new TmfTimestamp(interval.getStartTime(), ITmfTimestamp.NANOSECOND_SCALE),
-                            new TmfTimestamp(interval.getEndTime(), ITmfTimestamp.NANOSECOND_SCALE));
+                            TmfTimestamp.fromNanos(interval.getStartTime()),
+                            TmfTimestamp.fromNanos(interval.getEndTime()));
 
                     // update children recursively
                     updateStateEntries(ss, fullState, stateEntry, quark, timestamp);
@@ -365,13 +365,13 @@ public class TmfStateSystemViewer extends AbstractTmfTreeViewer {
 
         private final int fQuark;
         private final String fFullPath;
-        private @NonNull TmfTimestamp fStart;
-        private @NonNull TmfTimestamp fEnd;
+        private @NonNull ITmfTimestamp fStart;
+        private @NonNull ITmfTimestamp fEnd;
         private ITmfStateValue fValue;
         private boolean fModified;
         private boolean fOutOfRange = false;
 
-        public StateEntry(String name, int quark, String fullPath, ITmfStateValue value, @NonNull TmfTimestamp start, @NonNull TmfTimestamp end, boolean modified) {
+        public StateEntry(String name, int quark, String fullPath, ITmfStateValue value, @NonNull ITmfTimestamp start, @NonNull ITmfTimestamp end, boolean modified) {
             super(name);
             fQuark = quark;
             fFullPath = fullPath;
@@ -442,7 +442,7 @@ public class TmfStateSystemViewer extends AbstractTmfTreeViewer {
             return fModified;
         }
 
-        public void update(ITmfStateValue value, @NonNull TmfTimestamp start, @NonNull TmfTimestamp end) {
+        public void update(ITmfStateValue value, @NonNull ITmfTimestamp start, @NonNull ITmfTimestamp end) {
             fModified = false;
             fOutOfRange = false;
             if (!start.equals(fStart)) {
index 98990cf2a969038863eeffb6ca0a528bd637b2fa..571c19840f9b28c91457538789c15da04ecc7bd6 100644 (file)
@@ -76,8 +76,6 @@ public class TimeChartView extends TmfView implements ITimeGraphRangeListener, I
     /** TimeChartView's ID */
     public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.timechart"; //$NON-NLS-1$
 
-    private static final int TIMESTAMP_SCALE = -9;
-
     private final int fDisplayWidth;
     private TimeGraphViewer fViewer;
     private final List<TimeChartAnalysisEntry> fTimeAnalysisEntries = new ArrayList<>();
@@ -526,8 +524,8 @@ public class TimeChartView extends TmfView implements ITimeGraphRangeListener, I
         fStartTime = event.getStartTime();
         fStopTime = event.getEndTime();
         itemize(fStartTime, fStopTime);
-        final ITmfTimestamp startTimestamp = new TmfTimestamp(event.getStartTime(), ITmfTimestamp.NANOSECOND_SCALE);
-        final ITmfTimestamp endTimestamp = new TmfTimestamp(event.getEndTime(), ITmfTimestamp.NANOSECOND_SCALE);
+        final ITmfTimestamp startTimestamp = TmfTimestamp.fromNanos(event.getStartTime());
+        final ITmfTimestamp endTimestamp = TmfTimestamp.fromNanos(event.getEndTime());
         TmfTimeRange range = new TmfTimeRange(startTimestamp, endTimestamp);
         broadcast(new TmfWindowRangeUpdatedSignal(this, range));
     }
@@ -547,7 +545,7 @@ public class TimeChartView extends TmfView implements ITimeGraphRangeListener, I
 
     @Override
     public void timeSelected(TimeGraphTimeEvent event) {
-        broadcast(new TmfSelectionRangeUpdatedSignal(this, new TmfTimestamp(event.getBeginTime(), TIMESTAMP_SCALE), new TmfTimestamp(event.getEndTime(), TIMESTAMP_SCALE)));
+        broadcast(new TmfSelectionRangeUpdatedSignal(this, TmfTimestamp.fromNanos(event.getBeginTime()), TmfTimestamp.fromNanos(event.getEndTime())));
     }
 
     @Override
@@ -686,7 +684,6 @@ public class TimeChartView extends TmfView implements ITimeGraphRangeListener, I
         final long beginTime = signal.getBeginTime().toNanos();
         final long endTime = signal.getEndTime().toNanos();
 
-
         Display.getDefault().asyncExec(new Runnable() {
             @Override
             public void run() {
index d65a9f26418516d4b2923b6c54f4af75324c241d..5baea766ed0202ea4a6cb3d510ccf3ad6997b4af 100644 (file)
@@ -87,8 +87,9 @@ import org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceAdapterManager;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext;
@@ -1276,7 +1277,7 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
             public void timeRangeUpdated(TimeGraphRangeUpdateEvent event) {
                 final long startTime = event.getStartTime();
                 final long endTime = event.getEndTime();
-                TmfTimeRange range = new TmfTimeRange(new TmfNanoTimestamp(startTime), new TmfNanoTimestamp(endTime));
+                TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromNanos(startTime), TmfTimestamp.fromNanos(endTime));
                 broadcast(new TmfWindowRangeUpdatedSignal(AbstractTimeGraphView.this, range));
                 startZoomThread(startTime, endTime);
             }
@@ -1285,8 +1286,8 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
         fTimeGraphWrapper.getTimeGraphViewer().addTimeListener(new ITimeGraphTimeListener() {
             @Override
             public void timeSelected(TimeGraphTimeEvent event) {
-                TmfNanoTimestamp startTime = new TmfNanoTimestamp(event.getBeginTime());
-                TmfNanoTimestamp endTime = new TmfNanoTimestamp(event.getEndTime());
+                ITmfTimestamp startTime = TmfTimestamp.fromNanos(event.getBeginTime());
+                ITmfTimestamp endTime = TmfTimestamp.fromNanos(event.getEndTime());
                 broadcast(new TmfSelectionRangeUpdatedSignal(AbstractTimeGraphView.this, startTime, endTime));
             }
         });
@@ -1306,12 +1307,12 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
                                 marker.setAttribute(ITmfMarker.MARKER_DURATION, Long.toString(bookmark.getDuration()));
                                 marker.setAttribute(IMarker.LOCATION,
                                         NLS.bind(org.eclipse.tracecompass.internal.tmf.ui.Messages.TmfMarker_LocationTimeRange,
-                                                new TmfNanoTimestamp(bookmark.getTime()),
-                                                new TmfNanoTimestamp(bookmark.getTime() + bookmark.getDuration())));
+                                                TmfTimestamp.fromNanos(bookmark.getTime()),
+                                                TmfTimestamp.fromNanos(bookmark.getTime() + bookmark.getDuration())));
                             } else {
                                 marker.setAttribute(IMarker.LOCATION,
                                         NLS.bind(org.eclipse.tracecompass.internal.tmf.ui.Messages.TmfMarker_LocationTime,
-                                                new TmfNanoTimestamp(bookmark.getTime())));
+                                                TmfTimestamp.fromNanos(bookmark.getTime())));
                             }
                             marker.setAttribute(ITmfMarker.MARKER_COLOR, bookmark.getColor().toString());
                         }
index ba22f90cade07bee5d57ec26dd1ddcff03be6711..414b27318ac6b22f1050156d9a0f263a54729172 100755 (executable)
@@ -93,11 +93,11 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
     /**
      * The minimum time delta.
      */
-    private ITmfTimestamp fMinTime = new TmfTimestamp();
+    private ITmfTimestamp fMinTime = TmfTimestamp.fromSeconds(0);
     /**
      * The maximum time delta.
      */
-    private ITmfTimestamp fMaxTime = new TmfTimestamp();
+    private ITmfTimestamp fMaxTime = TmfTimestamp.fromSeconds(0);
     /**
      * The current zoom value.
      */
index b6f7ef1fe075094b90c30e52013b1b4b95749c72..0b4431628ec7ad3ee98fa3c655aa9e3ed2100ddf 100755 (executable)
@@ -70,11 +70,11 @@ public class AsyncMessage extends BaseMessage implements ITimeRange {
     /**
      * The time when the message begin
      */
-    private ITmfTimestamp fEndTime = new TmfTimestamp();
+    private ITmfTimestamp fEndTime = TmfTimestamp.fromSeconds(0);
     /**
      * The time when the message end
      */
-    private ITmfTimestamp fStartTime = new TmfTimestamp();
+    private ITmfTimestamp fStartTime = TmfTimestamp.fromSeconds(0);
     /**
      * The associated message.
      */
index 930a5f978477850596de86608ef9f5309600b697..dcb45a6b4890ca1bc95d69a6f06e6eb81d8a1a41 100755 (executable)
@@ -46,11 +46,11 @@ public class BasicFrame extends GraphNode {
     /**
      * Contains the max elapsed time between two consecutive messages in the whole frame
      */
-    private ITmfTimestamp fMaxTime = new TmfTimestamp(0);
+    private ITmfTimestamp fMaxTime = TmfTimestamp.fromSeconds(0);
     /**
      * Contains the min elapsed time between two consecutive messages in the whole frame
      */
-    private ITmfTimestamp fMinTime = new TmfTimestamp(0);
+    private ITmfTimestamp fMinTime = TmfTimestamp.fromSeconds(0);
     /**
      * Indicate if the min and max elapsed time between two consecutive messages in the whole frame need to be computed
      */
@@ -99,11 +99,11 @@ public class BasicFrame extends GraphNode {
     /**
      * The minimum time between messages of the sequence diagram frame.
      */
-    private ITmfTimestamp fMinSDTime = new TmfTimestamp();
+    private ITmfTimestamp fMinSDTime = TmfTimestamp.fromSeconds(0);
     /**
      * The maximum time between messages of the sequence diagram frame.
      */
-    private ITmfTimestamp fMaxSDTime = new TmfTimestamp();
+    private ITmfTimestamp fMaxSDTime = TmfTimestamp.fromSeconds(0);
     /**
      * Flag to indicate that initial minimum has to be computed.
      */
@@ -526,7 +526,7 @@ public class BasicFrame extends GraphNode {
         if (fComputeMinMax) {
             fMinTime = delta;
             if (fMinTime.compareTo(TmfTimestamp.ZERO) < 0) {
-                fMinTime = new TmfTimestamp(0, m1.getTime().getScale());
+                fMinTime = TmfTimestamp.create(0, m1.getTime().getScale());
             }
             fMaxTime = fMinTime;
             setComputeMinMax(false);
index 503c4acd3354d7462f1fd5cf2f222b276cef937e..a73f43137a0e03b7fcf5c7bb1627387dc3b647db 100755 (executable)
@@ -72,7 +72,7 @@ public class SyncMessage extends BaseMessage implements ITimeRange {
     /**
      * The time when the message occurs
      */
-    private ITmfTimestamp fEventTime = new TmfTimestamp();
+    private ITmfTimestamp fEventTime = TmfTimestamp.fromSeconds(0);
     /**
      * Flag whether the message has time information available or not
      */
index 1d40532c6147693f7dc11939bf56f506098fc9eb..a7b6650e38b4e908040cd9be9c40320d4a20373e 100755 (executable)
@@ -152,8 +152,8 @@ public class MinMaxDialog extends Dialog {
             max = Long.parseLong(fMaxText.getText());
             scale = Integer.parseInt(fScaleText.getText());
 
-            fSdWidget.getFrame().setMax(new TmfTimestamp(max, scale));
-            fSdWidget.getFrame().setMin(new TmfTimestamp(min, scale));
+            fSdWidget.getFrame().setMax(TmfTimestamp.create(max, scale));
+            fSdWidget.getFrame().setMin(TmfTimestamp.create(min, scale));
 
             fSdWidget.redraw();
 
index c649edcbfc14413c5efd429c63e800df8687afa8..c0c993041270dbd8165d23717850e4e9d6eca76f 100644 (file)
@@ -1181,7 +1181,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
         try {
             TmfTimeRange currentRange = TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange();
             long offset = fTrace == null ? 0 : currentRange.getEndTime().getDelta(currentRange.getStartTime()).toNanos();
-            TmfTimestamp initialEndOfWindow = new TmfTimestamp(startTime.getValue() + offset, startTime.getScale());
+            ITmfTimestamp initialEndOfWindow = TmfTimestamp.create(startTime.getValue() + offset, startTime.getScale());
             return new TmfTimeRange(startTime, initialEndOfWindow);
         }
         finally {
This page took 0.167542 seconds and 5 git commands to generate.