1 /*******************************************************************************
2 * Copyright (c) 2012 Ericsson
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
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.core
.event
;
16 * <b><u>ITmfTimestamp</u></b>
18 * The fundamental time reference in the TMF.
20 * It defines a generic timestamp interface in its most basic form:
22 * <li>timestamp = [value] * 10**[scale] +/- [precision]
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.
35 * @author Francois Chouinard
37 * @see TmfSimpleTimestamp
40 public interface ITmfTimestamp
extends Cloneable
, Comparable
<ITmfTimestamp
> {
42 // ------------------------------------------------------------------------
44 // ------------------------------------------------------------------------
47 * @return the timestamp value (magnitude)
49 public long getValue();
52 * @return the timestamp scale (exponent)
54 public int getScale();
57 * @return the timestamp precision (measurement tolerance)
59 public int getPrecision();
61 // ------------------------------------------------------------------------
63 // ------------------------------------------------------------------------
66 * Normalize (adjust scale and offset) of the timerstamp
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
72 public ITmfTimestamp
normalize(long offset
, int scale
) throws ArithmeticException
;
75 * Compares [this] and [ts] within timestamp precision
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)
81 public int compareTo(ITmfTimestamp ts
, boolean withinPrecision
);
84 * Returns the difference between [this] and [ts] as a timestamp
86 * @param ts the other timestamp
87 * @return the time difference (this - other) as an ITmfTimestamp
89 public ITmfTimestamp
getDelta(ITmfTimestamp ts
);
91 // ------------------------------------------------------------------------
93 // ------------------------------------------------------------------------
96 * @return a clone of the timestamp
98 public ITmfTimestamp
clone();
100 // ------------------------------------------------------------------------
102 // ------------------------------------------------------------------------
105 * @see java.lang.Comparable#compareTo(java.lang.Object)
108 public int compareTo(ITmfTimestamp ts
);
This page took 0.031781 seconds and 5 git commands to generate.