1 /*******************************************************************************
2 * Copyright (c) 2009, 2014 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 * Patrick Tasse - Support selection range
12 *******************************************************************************/
14 package org
.eclipse
.tracecompass
.tmf
.core
.signal
;
16 import static org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
.checkNotNull
;
18 import org
.eclipse
.jdt
.annotation
.NonNullByDefault
;
19 import org
.eclipse
.jdt
.annotation
.Nullable
;
20 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.ITmfTimestamp
;
23 * A new time range selection has been made.
25 * This is the selected time or time range. A single-timestamp selection is
26 * represented by a range where the start time is equal to the end time.
28 * To update the visible (zoom) range instead, use
29 * {@link TmfWindowRangeUpdatedSignal}.
31 * @author Francois Chouinard
35 public class TmfSelectionRangeUpdatedSignal
extends TmfSignal
{
37 private final ITmfTimestamp fBeginTime
;
38 private final ITmfTimestamp fEndTime
;
41 * Constructor for a single timestamp selection (start and end times will be
45 * Object sending this signal
47 * Timestamp of selection
49 public TmfSelectionRangeUpdatedSignal(@Nullable Object source
, ITmfTimestamp ts
) {
56 * Constructor for a time range selection.
59 * Object sending this signal
61 * Timestamp of begin of selection range
63 * Timestamp of end of selection range
65 public TmfSelectionRangeUpdatedSignal(@Nullable Object source
, ITmfTimestamp begin
, ITmfTimestamp end
) {
72 * @return The begin timestamp of selection
74 public ITmfTimestamp
getBeginTime() {
79 * @return The end timestamp of selection
81 public ITmfTimestamp
getEndTime() {
86 public String
toString() {
87 StringBuilder sb
= new StringBuilder();
88 sb
.append(getClass().getSimpleName());
89 sb
.append(" ["); //$NON-NLS-1$
90 sb
.append(fBeginTime
.toString());
91 if (!fBeginTime
.equals(fEndTime
)) {
93 sb
.append(fEndTime
.toString());
95 sb
.append("]"); //$NON-NLS-1$
96 return checkNotNull(sb
.toString());