tmf: Fix the actual end time of state system modules
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / signal / TmfSelectionRangeUpdatedSignal.java
CommitLineData
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 - Support selection range
8c8bf09f
ASL
12 *******************************************************************************/
13
2bdf0193 14package org.eclipse.tracecompass.tmf.core.signal;
8c8bf09f 15
6cfc180e
GB
16import org.eclipse.jdt.annotation.NonNullByDefault;
17import org.eclipse.jdt.annotation.Nullable;
2bdf0193 18import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
8c8bf09f
ASL
19
20/**
97c71024 21 * A new time range selection has been made.
0fcf3b09 22 *
97c71024
AM
23 * This is the selected time or time range. A single-timestamp selection is
24 * represented by a range where the start time is equal to the end time.
25 *
26 * To update the visible (zoom) range instead, use
27 * {@link TmfWindowRangeUpdatedSignal}.
0fcf3b09 28 *
4b7b3670 29 * @author Francois Chouinard
97c71024
AM
30 * @since 1.0
31 */
6cfc180e 32@NonNullByDefault
97c71024 33public class TmfSelectionRangeUpdatedSignal extends TmfSignal {
8c8bf09f 34
0fcf3b09
PT
35 private final ITmfTimestamp fBeginTime;
36 private final ITmfTimestamp fEndTime;
4f8ca6a1
AM
37
38 /**
97c71024
AM
39 * Constructor for a single timestamp selection (start and end times will be
40 * the same).
4f8ca6a1
AM
41 *
42 * @param source
43 * Object sending this signal
44 * @param ts
0fcf3b09 45 * Timestamp of selection
4f8ca6a1 46 */
97c71024 47 public TmfSelectionRangeUpdatedSignal(@Nullable Object source, ITmfTimestamp ts) {
4f8ca6a1 48 super(source);
0fcf3b09
PT
49 fBeginTime = ts;
50 fEndTime = ts;
51 }
52
53 /**
97c71024 54 * Constructor for a time range selection.
0fcf3b09
PT
55 *
56 * @param source
57 * Object sending this signal
58 * @param begin
59 * Timestamp of begin of selection range
60 * @param end
61 * Timestamp of end of selection range
0fcf3b09 62 */
97c71024 63 public TmfSelectionRangeUpdatedSignal(@Nullable Object source, ITmfTimestamp begin, ITmfTimestamp end) {
0fcf3b09
PT
64 super(source);
65 fBeginTime = begin;
66 fEndTime = end;
4f8ca6a1
AM
67 }
68
0fcf3b09
PT
69 /**
70 * @return The begin timestamp of selection
0fcf3b09
PT
71 */
72 public ITmfTimestamp getBeginTime() {
73 return fBeginTime;
74 }
75
76 /**
77 * @return The end timestamp of selection
0fcf3b09
PT
78 */
79 public ITmfTimestamp getEndTime() {
80 return fEndTime;
4f8ca6a1
AM
81 }
82
4f8ca6a1
AM
83 @Override
84 public String toString() {
0fcf3b09 85 StringBuilder sb = new StringBuilder();
97c71024
AM
86 sb.append(getClass().getSimpleName());
87 sb.append(" ["); //$NON-NLS-1$
6cfc180e
GB
88 sb.append(fBeginTime.toString());
89 if (!fBeginTime.equals(fEndTime)) {
90 sb.append('-');
91 sb.append(fEndTime.toString());
0fcf3b09 92 }
97c71024 93 sb.append("]"); //$NON-NLS-1$
0e4f957e 94 return sb.toString();
4f8ca6a1 95 }
8d2e2848 96
8c8bf09f 97}
This page took 0.096087 seconds and 5 git commands to generate.