Commit | Line | Data |
---|---|---|
8c8bf09f | 1 | /******************************************************************************* |
be4a197a | 2 | * Copyright (c) 2009, 2014 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 - Deprecate current time |
8c8bf09f ASL |
12 | *******************************************************************************/ |
13 | ||
2bdf0193 | 14 | package org.eclipse.tracecompass.tmf.core.signal; |
8c8bf09f | 15 | |
2bdf0193 | 16 | import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange; |
8c8bf09f ASL |
17 | |
18 | /** | |
0fcf3b09 PT |
19 | * A new time range has been selected. |
20 | * | |
21 | * This is the visible (zoom) time range. To synchronize on the selection range, | |
22 | * use {@link TmfTimeSynchSignal}. | |
4f8ca6a1 | 23 | * |
4b7b3670 | 24 | * @author Francois Chouinard |
8c8bf09f ASL |
25 | */ |
26 | public class TmfRangeSynchSignal extends TmfSignal { | |
27 | ||
c392540b | 28 | private final TmfTimeRange fCurrentRange; |
8c8bf09f | 29 | |
0fcf3b09 PT |
30 | /** |
31 | * Constructor | |
32 | * | |
33 | * @param source | |
34 | * Object sending this signal | |
35 | * @param range | |
36 | * The new time range | |
0fcf3b09 PT |
37 | */ |
38 | public TmfRangeSynchSignal(Object source, TmfTimeRange range) { | |
39 | super(source); | |
40 | fCurrentRange = range; | |
c392540b | 41 | } |
8c8bf09f | 42 | |
4f8ca6a1 AM |
43 | /** |
44 | * @return This signal's time range | |
45 | */ | |
c392540b FC |
46 | public TmfTimeRange getCurrentRange() { |
47 | return fCurrentRange; | |
48 | } | |
8c8bf09f | 49 | |
e9681c60 SM |
50 | @Override |
51 | public String toString() { | |
52 | StringBuilder sb = new StringBuilder("TmfRangeSynchSignal [source="); //$NON-NLS-1$ | |
53 | ||
54 | if (getSource() != null) { | |
55 | sb.append(getSource().toString()); | |
56 | } else { | |
57 | sb.append("null"); //$NON-NLS-1$ | |
58 | } | |
59 | ||
60 | sb.append(", range="); //$NON-NLS-1$ | |
61 | ||
62 | if (fCurrentRange != null) { | |
63 | sb.append(fCurrentRange.toString()); | |
64 | } else { | |
65 | sb.append("null"); //$NON-NLS-1$ | |
66 | } | |
67 | sb.append(']'); | |
68 | return sb.toString(); | |
69 | } | |
8c8bf09f | 70 | } |