1 /*******************************************************************************
2 * Copyright (c) 2009 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 * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.lttng
.ui
.model
.trange
;
14 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.timeAnalysis
.model
.ITimeEvent
;
15 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.timeAnalysis
.model
.ITmfTimeAnalysisEntry
;
22 public abstract class TimeRangeComponent
implements ITimeRangeComponent
, ITimeEvent
{
24 // ========================================================================
26 // =======================================================================
27 protected Long startTime
= 0L;
28 protected Long stopTime
= Long
.MAX_VALUE
;
29 protected TimeRangeComposite eventParent
= null;
30 private boolean visible
= true;
34 // ========================================================================
36 // =======================================================================
37 public TimeRangeComponent(Long stime
, Long etime
,
38 TimeRangeComposite eventParent
) {
39 this.startTime
= stime
;
40 this.stopTime
= etime
;
41 this.eventParent
= eventParent
;
44 // ========================================================================
46 // =======================================================================
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
56 public long getStartTime() {
57 return startTime
.longValue();
61 public void setStartTime(long time
) {
68 public long getStopTime() {
69 return stopTime
.longValue();
73 public void setStopTime(long stopTime
) {
75 this.stopTime
= stopTime
;
80 public ITimeRangeComponent
getEventParent() {
84 public void setEventParent(TimeRangeComposite eventParent
) {
85 this.eventParent
= eventParent
;
89 public abstract String
getName();
92 public void setVisible(boolean visible
) {
93 this.visible
= visible
;
97 * @see org.eclipse.linuxtools.lttng.ui.model.trange.ITimeRangeComponent#isVisible()
100 public boolean isVisible() {
105 public ITmfTimeAnalysisEntry
getEntry() {
110 public long getTime() {
115 public long getDuration() {
116 return stopTime
- startTime
;
120 @SuppressWarnings("nls")
121 public String
toString() {
122 return "[TimeRangeComponent:" + "startTime=" + startTime
+ ",stopTime=" + stopTime
+
123 ",parent=" + (eventParent
!= null ? eventParent
.id
: "null") + "]";