Revert "Fix for bug 381411: Implement ranked location in experiment."
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / event / ITmfTimestamp.java
1 /*******************************************************************************
2 * Copyright (c) 2012 Ericsson
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 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.tmf.core.event;
14
15 /**
16 * The fundamental time reference in the TMF.
17 * <p>
18 * It defines a generic timestamp interface in its most basic form:
19 * <ul>
20 * <li>timestamp = [value] * 10**[scale] +/- [precision]
21 * </ul>
22 * Where:
23 * <ul>
24 * <li>[value] is an unstructured integer value
25 * <li>[scale] is the magnitude of the value wrt some application-specific
26 * base unit (e.g. the second)
27 * <li>[precision] indicates the error on the value (useful for comparing
28 * timestamps in different scales). Default: 0.
29 * </ul>
30 *
31 * @version 1.0
32 * @author Francois Chouinard
33 *
34 * @see ITmfEvent
35 * @see TmfTimeRange
36 */
37 public interface ITmfTimestamp extends Comparable<ITmfTimestamp> {
38
39 // ------------------------------------------------------------------------
40 // Getters
41 // ------------------------------------------------------------------------
42
43 /**
44 * @return the timestamp value (magnitude)
45 */
46 public long getValue();
47
48 /**
49 * @return the timestamp scale (exponent)
50 */
51 public int getScale();
52
53 /**
54 * @return the timestamp precision (measurement tolerance)
55 */
56 public int getPrecision();
57
58 // ------------------------------------------------------------------------
59 // Operations
60 // ------------------------------------------------------------------------
61
62 /**
63 * Normalize (adjust scale and offset) of the timerstamp
64 *
65 * @param offset the offset to apply to the timestamp value (after scaling)
66 * @param scale the new timestamp scale
67 * @return a new 'adjusted' ITmfTimestamp
68 */
69 public ITmfTimestamp normalize(long offset, int scale);
70
71 /**
72 * Compares [this] and [ts] within timestamp precision
73 *
74 * @param ts the other timestamp
75 * @param withinPrecision consider the precision when testing for equality
76 * @return -1, 0 or 1 (less than, equals, greater than)
77 */
78 public int compareTo(ITmfTimestamp ts, boolean withinPrecision);
79
80 /**
81 * Returns the difference between [this] and [ts] as a timestamp
82 *
83 * @param ts the other timestamp
84 * @return the time difference (this - other) as an ITmfTimestamp
85 */
86 public ITmfTimestamp getDelta(ITmfTimestamp ts);
87
88 /**
89 * @return a clone of the timestamp
90 */
91 public ITmfTimestamp clone();
92
93 // ------------------------------------------------------------------------
94 // Comparable
95 // ------------------------------------------------------------------------
96
97 /* (non-Javadoc)
98 * @see java.lang.Comparable#compareTo(java.lang.Object)
99 */
100 @Override
101 int compareTo(ITmfTimestamp ts);
102
103 }
This page took 0.051105 seconds and 5 git commands to generate.