[290968] Contribution
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / model / trange / TimeRangeComposite.java
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 import java.util.Vector;
15
16 import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;
17
18 public class TimeRangeComposite extends TimeRangeComponent implements
19 ITmfTimeAnalysisEntry {
20
21 // ========================================================================
22 // Data
23 // =======================================================================
24 /**
25 * Type of Composites or Containers
26 * <p>
27 * PROPERTY: Refers to a sub-composite of a RESOURCE or a PROCESS e.g the
28 * cpu which can vary over time and can have time range events associated to
29 * it, and at the same time PROPERTY is associated to a Composite parent
30 * like a PROCESS
31 * </p>
32 * <p>
33 * PROCESS: A composite of time range events representing a Process
34 * </p>
35 * <p>
36 * RESOURCE: A composite of time range events representing a resource i.g.
37 * irq, softIrq, trap, bdev, cpu
38 * </p>
39 *
40 * @author alvaro
41 *
42 */
43 public static enum CompositeType {
44 UNKNOWN, PROPERTY, PROCESS, RESOURCE
45 }
46
47 protected final Vector<TimeRangeComponent> ChildEventLeafs = new Vector<TimeRangeComponent>();
48 protected final Vector<TimeRangeComponent> ChildEventComposites = new Vector<TimeRangeComponent>();
49 protected Integer id = 0;
50 protected String name;
51 protected String groupName = "";
52 protected String className = "";
53 protected CompositeType contType = CompositeType.UNKNOWN;
54 protected long next_good_time = -1;
55
56 // ========================================================================
57 // Constructors
58 // =======================================================================
59 public TimeRangeComposite(Integer id, Long stime, Long etime, String name, CompositeType type) {
60 super(stime, etime, null);
61 this.id = id;
62 this.name = name;
63 contType = type;
64 next_good_time = stime;
65 }
66
67 public TimeRangeComposite(Integer id, Long stime, Long etime, String name, String groupName, String className, CompositeType type) {
68 this(id, stime, etime, name, type);
69
70 this.groupName = groupName;
71 this.className = className;
72
73 }
74
75 // ========================================================================
76 // Methods
77 // =======================================================================
78
79 /*
80 * (non-Javadoc)
81 *
82 * @see
83 * org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeComponent#getName()
84 */
85 @Override
86 public String getName() {
87 return name;
88 }
89
90 /**
91 * @param name
92 */
93 public void setName(String name) {
94 this.name = name;
95 }
96
97 /*
98 * (non-Javadoc)
99 *
100 * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
101 * ITmfTimeAnalysisEntry#getGroupName()
102 */
103 public String getGroupName() {
104 return groupName;
105 }
106
107 /**
108 * @param groupName
109 */
110 public void setGroupName(String groupName) {
111 this.groupName = groupName;
112 }
113
114 /*
115 * (non-Javadoc)
116 *
117 * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
118 * ITmfTimeAnalysisEntry#getId()
119 */
120 public int getId() {
121 return id;
122 }
123
124 /**
125 * @param id
126 */
127 public void setId(int id) {
128 this.id = id;
129 }
130
131 /**
132 * @return
133 */
134 public String getClassName() {
135 return className;
136 }
137
138 /**
139 * @param className
140 */
141 public void setClassName(String className) {
142 this.className = className;
143 }
144
145 /*
146 * (non-Javadoc)
147 *
148 * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
149 * ITmfTimeAnalysisEntry#getTraceEvents()
150 */
151 @SuppressWarnings("unchecked")
152 public Vector<TimeRangeComponent> getTraceEvents() {
153 return ChildEventLeafs;
154 }
155
156 /**
157 * @return
158 */
159 public Vector<TimeRangeComponent> getChildEventComposites() {
160 return ChildEventComposites;
161 }
162
163 /**
164 * Represents the time where the next time range can start the drawing i.e.
165 * right after previous time range.
166 *
167 * @return
168 */
169 public long getNext_good_time() {
170 return next_good_time;
171 }
172
173 /**
174 * Represents the time where the next time range can start the drawing i.e.
175 * right after previous time range.
176 *
177 * @param nextGoodTime
178 */
179 public void setNext_good_time(long nextGoodTime) {
180 next_good_time = nextGoodTime;
181 }
182
183 /**
184 * Reset this resource to the construction state except for
185 */
186 public void reset() {
187 getChildEventComposites().clear();
188 getTraceEvents().clear();
189 next_good_time = startTime;
190 }
191 }
This page took 0.038128 seconds and 5 git commands to generate.