Commit | Line | Data |
---|---|---|
d7d40e67 | 1 | /********************************************************************** |
843c272b | 2 | * Copyright (c) 2013, 2014 Ericsson, École Polytechnique de Montréal |
d7d40e67 BH |
3 | * |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Bernd Hufmann - Initial API and implementation | |
843c272b | 11 | * Geneviève Bastien - Moved some methods to ITmfTimeProvider |
d7d40e67 | 12 | **********************************************************************/ |
2bdf0193 | 13 | package org.eclipse.tracecompass.tmf.ui.viewers.xycharts; |
d7d40e67 | 14 | |
2bdf0193 | 15 | import org.eclipse.tracecompass.tmf.ui.viewers.ITmfTimeProvider; |
d7d40e67 BH |
16 | |
17 | /** | |
843c272b GB |
18 | * Interface adding some methods specific for SWT charts to the base time |
19 | * provider interface. Typically, the time will be shown on the x-axis. | |
d7d40e67 BH |
20 | * |
21 | * @author Bernd Hufmann | |
d7d40e67 | 22 | */ |
843c272b | 23 | public interface ITmfChartTimeProvider extends ITmfTimeProvider { |
d7d40e67 BH |
24 | |
25 | /** | |
26 | * Returns a constant time offset that is used to normalize the time values | |
843c272b GB |
27 | * to a range of 0..53 bits to avoid loss of precision when converting long |
28 | * <-> double. | |
d7d40e67 | 29 | * |
843c272b GB |
30 | * Time values are stored in TMF as long values. The SWT chart library uses |
31 | * values of type double (on x and y axis). To avoid loss of precision when | |
32 | * converting long <-> double the values need to fit within 53 bits. | |
d7d40e67 BH |
33 | * |
34 | * Subtract the offset when using time values provided externally for | |
35 | * internal usage in SWT chart. Add the offset when using time values | |
36 | * provided by SWT chart (e.g. for display purposes) and when broadcasting | |
37 | * them externally (e.g. time synchronization signals). | |
38 | * | |
843c272b GB |
39 | * For example the offset can be calculated as the time of the first time |
40 | * value in the current time range to be displayed in the chart. Add +1 to | |
41 | * avoid 0 when using logarithmic scale. | |
d7d40e67 | 42 | * |
843c272b GB |
43 | * t0=10000, t2=20000, tn=N -> timeOffset=t0-1 -> t0'=1, t1'=10001, |
44 | * tn'=N-timeOffset | |
d7d40e67 | 45 | * |
843c272b GB |
46 | * where t0 ... tn are times used externally and t0' ... tn' are times used |
47 | * internally by the SWT chart. | |
d7d40e67 BH |
48 | * |
49 | * @return the time offset | |
50 | */ | |
51 | long getTimeOffset(); | |
52 | ||
53 | } |