Commit | Line | Data |
---|---|---|
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 | *******************************************************************************/ | |
12 | package org.eclipse.linuxtools.lttng.ui.model.trange; | |
13 | ||
14 | ||
15 | /** | |
16 | * @author alvaro | |
17 | * | |
18 | */ | |
19 | public abstract class TimeRangeComponent implements ITimeRangeComponent { | |
20 | ||
21 | // ======================================================================== | |
22 | // Data | |
23 | // ======================================================================= | |
24 | protected Long startTime = 0L; | |
25 | protected Long stopTime = Long.MAX_VALUE; | |
26 | protected TimeRangeComposite eventParent = null; | |
27 | private boolean visible = true; | |
28 | ||
29 | ||
30 | ||
31 | // ======================================================================== | |
32 | // Constructor | |
33 | // ======================================================================= | |
34 | public TimeRangeComponent(Long stime, Long etime, | |
35 | TimeRangeComposite eventParent) { | |
36 | this.startTime = stime; | |
37 | this.stopTime = etime; | |
38 | this.eventParent = eventParent; | |
39 | } | |
40 | ||
41 | // ======================================================================== | |
42 | // Methods | |
43 | // ======================================================================= | |
44 | /** | |
45 | * This method shall not be used to estimate the starting drawing point of | |
46 | * the time range-event. see interface method getTime(). However this method | |
47 | * can be used to retrieve the tool tip information where we need to reflect | |
48 | * that the actual start of this event is unknown | |
49 | * | |
50 | * @param time | |
51 | */ | |
d4011df2 | 52 | @Override |
6e512b93 ASL |
53 | public long getStartTime() { |
54 | return startTime.longValue(); | |
55 | } | |
56 | ||
d4011df2 | 57 | @Override |
6e512b93 ASL |
58 | public void setStartTime(long time) { |
59 | if (time > -1) { | |
60 | startTime = time; | |
61 | } | |
62 | } | |
63 | ||
d4011df2 | 64 | @Override |
6e512b93 ASL |
65 | public long getStopTime() { |
66 | return stopTime.longValue(); | |
67 | } | |
68 | ||
d4011df2 | 69 | @Override |
6e512b93 ASL |
70 | public void setStopTime(long stopTime) { |
71 | if (stopTime > -1) { | |
72 | this.stopTime = stopTime; | |
73 | } | |
74 | } | |
75 | ||
d4011df2 | 76 | @Override |
6e512b93 ASL |
77 | public ITimeRangeComponent getEventParent() { |
78 | return eventParent; | |
79 | } | |
80 | ||
81 | public void setEventParent(TimeRangeComposite eventParent) { | |
82 | this.eventParent = eventParent; | |
83 | } | |
84 | ||
d4011df2 | 85 | @Override |
6e512b93 ASL |
86 | public abstract String getName(); |
87 | ||
88 | ||
89 | public void setVisible(boolean visible) { | |
90 | this.visible = visible; | |
91 | } | |
92 | ||
93 | /* (non-Javadoc) | |
94 | * @see org.eclipse.linuxtools.lttng.ui.model.trange.ITimeRangeComponent#isVisible() | |
95 | */ | |
d4011df2 | 96 | @Override |
6e512b93 ASL |
97 | public boolean isVisible() { |
98 | return visible; | |
99 | } | |
0c2a2e08 FC |
100 | |
101 | @Override | |
102 | public String toString() { | |
103 | return "[TimeRangeComponent:" + "startTime=" + startTime + ",stopTime=" + stopTime + | |
104 | ",parent=" + (eventParent != null ? eventParent.id : "null") + "]"; | |
105 | } | |
106 | ||
6e512b93 | 107 | } |