TMF: Add some non null annotations to TmfTimeRange
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / signal / TmfTimeSynchSignal.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 2014 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.tracecompass.tmf.core.signal;
15
16 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
21
22 /**
23 * A new time or time range selection has been made.
24 *
25 * This is the selected time or time range. To synchronize on the visible
26 * (zoom) range, use {@link TmfRangeSynchSignal}.
27 *
28 * @author Francois Chouinard
29 */
30 @NonNullByDefault
31 public class TmfTimeSynchSignal extends TmfSignal {
32
33 private final ITmfTimestamp fBeginTime;
34 private final ITmfTimestamp fEndTime;
35
36 /**
37 * Constructor
38 *
39 * @param source
40 * Object sending this signal
41 * @param ts
42 * Timestamp of selection
43 */
44 public TmfTimeSynchSignal(@Nullable Object source, ITmfTimestamp ts) {
45 super(source);
46 fBeginTime = ts;
47 fEndTime = ts;
48 }
49
50 /**
51 * Constructor
52 *
53 * @param source
54 * Object sending this signal
55 * @param begin
56 * Timestamp of begin of selection range
57 * @param end
58 * Timestamp of end of selection range
59 */
60 public TmfTimeSynchSignal(@Nullable Object source, ITmfTimestamp begin, ITmfTimestamp end) {
61 super(source);
62 fBeginTime = begin;
63 fEndTime = end;
64 }
65
66 /**
67 * @return The begin timestamp of selection
68 */
69 public ITmfTimestamp getBeginTime() {
70 return fBeginTime;
71 }
72
73 /**
74 * @return The end timestamp of selection
75 */
76 public ITmfTimestamp getEndTime() {
77 return fEndTime;
78 }
79
80 @Override
81 public String toString() {
82 StringBuilder sb = new StringBuilder();
83 sb.append("[TmfTimeSynchSignal ("); //$NON-NLS-1$
84 sb.append(fBeginTime.toString());
85 if (!fBeginTime.equals(fEndTime)) {
86 sb.append('-');
87 sb.append(fEndTime.toString());
88 }
89 sb.append(")]"); //$NON-NLS-1$
90 return checkNotNull(sb.toString());
91 }
92
93 }
This page took 0.032729 seconds and 5 git commands to generate.