tmf: Use tabs in statistics view for each traces
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.core / src / org / eclipse / linuxtools / internal / lttng / core / event / LttngSyntheticEvent.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 2010 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.internal.lttng.core.event;
13
14 import org.eclipse.linuxtools.internal.lttng.core.state.model.LttngTraceState;
15 import org.eclipse.linuxtools.lttng.jni.JniEvent;
16 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
17 import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
18
19 /**
20 * @author alvaro
21 *
22 */
23 public class LttngSyntheticEvent extends LttngEvent {
24
25 public static final LttngSyntheticEvent NullEvent = new LttngSyntheticEvent();
26
27 // ======================================================================+
28 // Data
29 // =======================================================================
30 /**
31 * <p>
32 * BEFORE: Before the update to the state system
33 * </p>
34 * <p>
35 * UPDATE: Proceed to update the state system
36 * </p>
37 * <p>
38 * AFTER: After the update of the state system
39 * </p>
40 * <p>
41 * ACK: Acknowledge indicator for any of the previous sequences
42 * </p>
43 */
44 public enum SequenceInd {
45 STARTREQ, BEFORE, UPDATE, AFTER, ENDREQ
46 };
47
48 private SequenceInd sequence = SequenceInd.BEFORE;
49 private LttngEvent baseEvent = null;
50 private LttngTraceState fTraceModel = null;
51 // ======================================================================+
52 // Constructors
53 // =======================================================================
54 /**
55 * @param baseEvent
56 */
57 public LttngSyntheticEvent(ITmfEvent baseEvent) {
58 super(baseEvent);
59 this.baseEvent = (LttngEvent) baseEvent;
60 }
61
62 /**
63 * @param parent
64 * @param timestamp
65 * @param source
66 * @param type
67 * @param content
68 * @param reference
69 * @param lttEvent
70 */
71 public LttngSyntheticEvent(TmfTrace parent,
72 LttngTimestamp timestamp, String source,
73 LttngEventType type, LttngEventContent content,
74 String reference, JniEvent lttEvent) {
75 super(parent, timestamp, source, type, content, reference, lttEvent);
76 }
77
78 private LttngSyntheticEvent() {
79 this(null, null, null, null, null, null, null);
80 }
81
82 // ======================================================================+
83 // Methods
84 // =======================================================================
85
86 /**
87 * @return the sequence indicator
88 */
89 public SequenceInd getSynType() {
90 return sequence;
91 }
92
93 /**
94 * @param type
95 * the sequence indicator to set
96 */
97 public void setSequenceInd(SequenceInd sequence) {
98 this.sequence = sequence;
99 }
100
101 /**
102 * @return the baseEvent
103 */
104 public LttngEvent getBaseEvent() {
105 return baseEvent;
106 }
107
108 /**
109 * @param traceModel
110 * the trace state-data-model associated to this event
111 */
112 public void setTraceModel(LttngTraceState traceModel) {
113 this.fTraceModel = traceModel;
114 }
115
116 /**
117 * @return the traceModel
118 */
119 public LttngTraceState getTraceModel() {
120 return fTraceModel;
121 }
122
123 /**
124 * /* (non-Javadoc)
125 *
126 * @see org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent#getTrace()
127 */
128 @Override
129 public TmfTrace getTrace() {
130 if (baseEvent != null) {
131 return (TmfTrace) baseEvent.getTrace();
132 } else {
133 return (TmfTrace) super.getTrace();
134 }
135 }
136
137 /*
138 * (non-Javadoc)
139 *
140 * @see
141 * org.eclipse.linuxtools.lttng.event.LttngEvent#setParentTrace(org.eclipse
142 * .linuxtools.tmf.trace.TmfTrace)
143 */
144 @Override
145 public void setParentTrace(TmfTrace parentTrace) {
146 if (baseEvent != null) {
147 baseEvent.setParentTrace(parentTrace);
148 } else {
149 super.setParentTrace(parentTrace);
150 }
151 }
152
153 /*
154 * (non-Javadoc)
155 *
156 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getChannelName()
157 */
158 @Override
159 public String getChannelName() {
160 if (baseEvent != null) {
161 return baseEvent.getChannelName();
162 } else {
163 return super.getChannelName();
164 }
165 }
166
167 /*
168 * (non-Javadoc)
169 *
170 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getCpuId()
171 */
172 @Override
173 public long getCpuId() {
174 if (baseEvent != null) {
175 return baseEvent.getCpuId();
176 } else {
177 return super.getCpuId();
178 }
179 }
180
181 /*
182 * (non-Javadoc)
183 *
184 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getMarkerName()
185 */
186 @Override
187 public String getMarkerName() {
188 if (baseEvent != null) {
189 return baseEvent.getMarkerName();
190 } else {
191 return super.getMarkerName();
192 }
193 }
194
195 /*
196 * (non-Javadoc)
197 *
198 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getContent()
199 */
200 @Override
201 public LttngEventContent getContent() {
202 if (baseEvent != null) {
203 return baseEvent.getContent();
204 } else {
205 return super.getContent();
206 }
207 }
208
209 /*
210 * (non-Javadoc)
211 *
212 * @see
213 * org.eclipse.linuxtools.lttng.event.LttngEvent#setContent(org.eclipse.
214 * linuxtools.lttng.event.LttngEventContent)
215 */
216 @Override
217 public void setContent(LttngEventContent newContent) {
218 if (baseEvent != null) {
219 baseEvent.setContent(newContent);
220 } else {
221 super.setContent(newContent);
222 }
223 }
224
225 /*
226 * (non-Javadoc)
227 *
228 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getType()
229 */
230 @Override
231 public LttngEventType getType() {
232 if (baseEvent != null) {
233 return baseEvent.getType();
234 } else {
235 return super.getType();
236 }
237 }
238
239 /*
240 * (non-Javadoc)
241 *
242 * @see
243 * org.eclipse.linuxtools.lttng.event.LttngEvent#setType(org.eclipse.linuxtools
244 * .lttng.event.LttngEventType)
245 */
246 @Override
247 public void setType(LttngEventType newType) {
248 if (baseEvent != null) {
249 baseEvent.setType(newType);
250 } else {
251 super.setType(newType);
252 }
253 }
254
255 /*
256 * (non-Javadoc)
257 *
258 * @see
259 * org.eclipse.linuxtools.lttng.event.LttngEvent#updateJniEventReference
260 * (org.eclipse.linuxtools.lttng.jni.JniEvent)
261 */
262 @Override
263 public void updateJniEventReference(JniEvent newJniEventReference) {
264 if (baseEvent != null) {
265 baseEvent.updateJniEventReference(newJniEventReference);
266 } else {
267 super.updateJniEventReference(newJniEventReference);
268 }
269 }
270
271 /*
272 * (non-Javadoc)
273 *
274 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#convertEventTmfToJni()
275 */
276 @Override
277 public JniEvent convertEventTmfToJni() {
278 if (baseEvent != null) {
279 return baseEvent.convertEventTmfToJni();
280 } else {
281 return super.convertEventTmfToJni();
282 }
283 }
284
285 /*
286 * (non-Javadoc)
287 *
288 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#toString()
289 */
290 @Override
291 public String toString() {
292 if (baseEvent != null) {
293 return baseEvent.toString();
294 } else {
295 return super.toString();
296 }
297 }
298
299 /* (non-Javadoc)
300 * @see java.lang.Object#hashCode()
301 */
302 @Override
303 public int hashCode() {
304 final int prime = 31;
305 int result = super.hashCode();
306 result = prime * result + ((baseEvent == null) ? 0 : baseEvent.hashCode());
307 result = prime * result + ((fTraceModel == null) ? 0 : fTraceModel.hashCode());
308 result = prime * result + ((sequence == null) ? 0 : sequence.hashCode());
309 return result;
310 }
311
312 /* (non-Javadoc)
313 * @see java.lang.Object#equals(java.lang.Object)
314 */
315 @Override
316 public boolean equals(Object obj) {
317 if (this == obj) {
318 return true;
319 }
320 if (!super.equals(obj)) {
321 return false;
322 }
323 if (!(obj instanceof LttngSyntheticEvent)) {
324 return false;
325 }
326 LttngSyntheticEvent other = (LttngSyntheticEvent) obj;
327 if (baseEvent == null) {
328 if (other.baseEvent != null) {
329 return false;
330 }
331 } else if (!baseEvent.equals(other.baseEvent)) {
332 return false;
333 }
334 if (fTraceModel == null) {
335 if (other.fTraceModel != null) {
336 return false;
337 }
338 } else if (!fTraceModel.equals(other.fTraceModel)) {
339 return false;
340 }
341 if (sequence != other.sequence) {
342 return false;
343 }
344 return true;
345 }
346
347 }
This page took 0.039725 seconds and 5 git commands to generate.