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