tmf: Add support for time range selection
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / signal / TmfTimeSynchSignal.java
CommitLineData
8c8bf09f 1/*******************************************************************************
61759503 2 * Copyright (c) 2009, 2013 Ericsson
4f8ca6a1 3 *
8c8bf09f
ASL
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
4f8ca6a1 8 *
8c8bf09f
ASL
9 * Contributors:
10 * Francois Chouinard - Initial API and implementation
0fcf3b09 11 * Patrick Tasse - Support selection range
8c8bf09f
ASL
12 *******************************************************************************/
13
6c13869b 14package org.eclipse.linuxtools.tmf.core.signal;
8c8bf09f 15
3bd46eef 16import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
8c8bf09f
ASL
17
18/**
0fcf3b09
PT
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 *
4b7b3670
FC
24 * @version 1.0
25 * @author Francois Chouinard
26*/
8c8bf09f
ASL
27public class TmfTimeSynchSignal extends TmfSignal {
28
0fcf3b09
PT
29 private final ITmfTimestamp fBeginTime;
30 private final ITmfTimestamp fEndTime;
4f8ca6a1
AM
31
32 /**
33 * Constructor
34 *
35 * @param source
36 * Object sending this signal
37 * @param ts
0fcf3b09 38 * Timestamp of selection
3bd46eef 39 * @since 2.0
4f8ca6a1
AM
40 */
41 public TmfTimeSynchSignal(Object source, ITmfTimestamp ts) {
42 super(source);
0fcf3b09
PT
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;
4f8ca6a1
AM
62 }
63
64 /**
65 * @return The synchronization timestamp of this signal
3bd46eef 66 * @since 2.0
0fcf3b09 67 * @deprecated As of 2.1, use {@link #getBeginTime()} and {@link #getEndTime()}
4f8ca6a1 68 */
0fcf3b09 69 @Deprecated
4f8ca6a1 70 public ITmfTimestamp getCurrentTime() {
0fcf3b09
PT
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;
4f8ca6a1
AM
88 }
89
4f8ca6a1
AM
90 @Override
91 public String toString() {
0fcf3b09
PT
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();
4f8ca6a1 103 }
8d2e2848 104
8c8bf09f 105}
This page took 0.044996 seconds and 5 git commands to generate.