Merge branch 'master' into lttng-luna
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / signal / TmfTimeSynchSignal.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 2013 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 * Patrick Tasse - Support selection range
12 *******************************************************************************/
13
14 package org.eclipse.linuxtools.tmf.core.signal;
15
16 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
17
18 /**
19 * A new time or time range selection has been made.
20 *
21 * This is the selected time or time range. To synchronize on the visible
22 * (zoom) range, use {@link TmfRangeSynchSignal}.
23 *
24 * @version 1.0
25 * @author Francois Chouinard
26 */
27 public class TmfTimeSynchSignal extends TmfSignal {
28
29 private final ITmfTimestamp fBeginTime;
30 private final ITmfTimestamp fEndTime;
31
32 /**
33 * Constructor
34 *
35 * @param source
36 * Object sending this signal
37 * @param ts
38 * Timestamp of selection
39 * @since 2.0
40 */
41 public TmfTimeSynchSignal(Object source, ITmfTimestamp ts) {
42 super(source);
43 fBeginTime = ts;
44 fEndTime = ts;
45 }
46
47 /**
48 * Constructor
49 *
50 * @param source
51 * Object sending this signal
52 * @param begin
53 * Timestamp of begin of selection range
54 * @param end
55 * Timestamp of end of selection range
56 * @since 2.1
57 */
58 public TmfTimeSynchSignal(Object source, ITmfTimestamp begin, ITmfTimestamp end) {
59 super(source);
60 fBeginTime = begin;
61 fEndTime = end;
62 }
63
64 /**
65 * @return The synchronization timestamp of this signal
66 * @since 2.0
67 * @deprecated As of 2.1, use {@link #getBeginTime()} and {@link #getEndTime()}
68 */
69 @Deprecated
70 public ITmfTimestamp getCurrentTime() {
71 return fBeginTime;
72 }
73
74 /**
75 * @return The begin timestamp of selection
76 * @since 2.1
77 */
78 public ITmfTimestamp getBeginTime() {
79 return fBeginTime;
80 }
81
82 /**
83 * @return The end timestamp of selection
84 * @since 2.1
85 */
86 public ITmfTimestamp getEndTime() {
87 return fEndTime;
88 }
89
90 @Override
91 public String toString() {
92 StringBuilder sb = new StringBuilder();
93 sb.append("[TmfTimeSynchSignal ("); //$NON-NLS-1$
94 if (fBeginTime != null) {
95 sb.append(fBeginTime.toString());
96 if (!fBeginTime.equals(fEndTime) && fEndTime != null) {
97 sb.append('-');
98 sb.append(fEndTime.toString());
99 }
100 }
101 sb.append(")]"); //$NON-NLS-1$
102 return sb.toString();
103 }
104
105 }
This page took 0.033319 seconds and 5 git commands to generate.