Fix for Bug338151
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / model / trange / TimeRangeComponent.java
CommitLineData
6e512b93
ASL
1/*******************************************************************************
2 * Copyright (c) 2009 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 * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12package org.eclipse.linuxtools.lttng.ui.model.trange;
13
90e2b925
FC
14import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent;
15import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
16
6e512b93
ASL
17
18/**
19 * @author alvaro
20 *
21 */
90e2b925 22public abstract class TimeRangeComponent implements ITimeRangeComponent, ITimeEvent {
6e512b93
ASL
23
24 // ========================================================================
25 // Data
26 // =======================================================================
27 protected Long startTime = 0L;
28 protected Long stopTime = Long.MAX_VALUE;
29 protected TimeRangeComposite eventParent = null;
30 private boolean visible = true;
31
32
33
34 // ========================================================================
35 // Constructor
36 // =======================================================================
37 public TimeRangeComponent(Long stime, Long etime,
38 TimeRangeComposite eventParent) {
39 this.startTime = stime;
40 this.stopTime = etime;
41 this.eventParent = eventParent;
42 }
43
44 // ========================================================================
45 // Methods
46 // =======================================================================
47 /**
48 * This method shall not be used to estimate the starting drawing point of
49 * the time range-event. see interface method getTime(). However this method
50 * can be used to retrieve the tool tip information where we need to reflect
51 * that the actual start of this event is unknown
52 *
53 * @param time
54 */
d4011df2 55 @Override
6e512b93
ASL
56 public long getStartTime() {
57 return startTime.longValue();
58 }
59
d4011df2 60 @Override
6e512b93
ASL
61 public void setStartTime(long time) {
62 if (time > -1) {
63 startTime = time;
64 }
65 }
66
d4011df2 67 @Override
6e512b93
ASL
68 public long getStopTime() {
69 return stopTime.longValue();
70 }
71
d4011df2 72 @Override
6e512b93
ASL
73 public void setStopTime(long stopTime) {
74 if (stopTime > -1) {
75 this.stopTime = stopTime;
76 }
77 }
78
d4011df2 79 @Override
6e512b93
ASL
80 public ITimeRangeComponent getEventParent() {
81 return eventParent;
82 }
83
84 public void setEventParent(TimeRangeComposite eventParent) {
85 this.eventParent = eventParent;
86 }
87
d4011df2 88 @Override
6e512b93
ASL
89 public abstract String getName();
90
91
92 public void setVisible(boolean visible) {
93 this.visible = visible;
94 }
95
96 /* (non-Javadoc)
97 * @see org.eclipse.linuxtools.lttng.ui.model.trange.ITimeRangeComponent#isVisible()
98 */
d4011df2 99 @Override
6e512b93
ASL
100 public boolean isVisible() {
101 return visible;
102 }
0c2a2e08 103
90e2b925
FC
104 @Override
105 public ITmfTimeAnalysisEntry getEntry() {
106 return eventParent;
107 }
108
109 @Override
110 public long getTime() {
111 return startTime;
112 }
113
114 @Override
115 public long getDuration() {
116 return stopTime - startTime;
117 }
118
0c2a2e08 119 @Override
9c4eb5f7 120 @SuppressWarnings("nls")
0c2a2e08
FC
121 public String toString() {
122 return "[TimeRangeComponent:" + "startTime=" + startTime + ",stopTime=" + stopTime +
123 ",parent=" + (eventParent != null ? eventParent.id : "null") + "]";
124 }
125
6e512b93 126}
This page took 0.031775 seconds and 5 git commands to generate.