Rename xxx.lttng to xxx.lttng.core
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.core / src / org / eclipse / linuxtools / lttng / 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.lttng.event;
13
14 import org.eclipse.linuxtools.lttng.jni.JniEvent;
15 import org.eclipse.linuxtools.lttng.state.model.LttngTraceState;
16 import org.eclipse.linuxtools.tmf.event.TmfEventSource;
17 import org.eclipse.linuxtools.tmf.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(LttngEvent baseEvent) {
58 super(baseEvent);
59 this.baseEvent = 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<LttngEvent> parent,
72 LttngTimestamp timestamp, TmfEventSource source,
73 LttngEventType type, LttngEventContent content,
74 LttngEventReference 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.lttng.event.LttngEvent#getParentTrace()
127 */
128 @SuppressWarnings("unchecked")
129 @Override
130 public TmfTrace<LttngEvent> getParentTrace() {
131 if (baseEvent != null) {
132 return (TmfTrace<LttngEvent>) baseEvent.getParentTrace();
133 } else {
134 return (TmfTrace<LttngEvent>) super.getParentTrace();
135 }
136 }
137
138 /*
139 * (non-Javadoc)
140 *
141 * @see
142 * org.eclipse.linuxtools.lttng.event.LttngEvent#setParentTrace(org.eclipse
143 * .linuxtools.tmf.trace.TmfTrace)
144 */
145 @Override
146 public void setParentTrace(TmfTrace<LttngEvent> parentTrace) {
147 if (baseEvent != null) {
148 baseEvent.setParentTrace(parentTrace);
149 } else {
150 super.setParentTrace(parentTrace);
151 }
152 }
153
154 /*
155 * (non-Javadoc)
156 *
157 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getChannelName()
158 */
159 @Override
160 public String getChannelName() {
161 if (baseEvent != null) {
162 return baseEvent.getChannelName();
163 } else {
164 return super.getChannelName();
165 }
166 }
167
168 /*
169 * (non-Javadoc)
170 *
171 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getCpuId()
172 */
173 @Override
174 public long getCpuId() {
175 if (baseEvent != null) {
176 return baseEvent.getCpuId();
177 } else {
178 return super.getCpuId();
179 }
180 }
181
182 /*
183 * (non-Javadoc)
184 *
185 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getMarkerName()
186 */
187 @Override
188 public String getMarkerName() {
189 if (baseEvent != null) {
190 return baseEvent.getMarkerName();
191 } else {
192 return super.getMarkerName();
193 }
194 }
195
196 /*
197 * (non-Javadoc)
198 *
199 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getContent()
200 */
201 @Override
202 public LttngEventContent getContent() {
203 if (baseEvent != null) {
204 return baseEvent.getContent();
205 } else {
206 return super.getContent();
207 }
208 }
209
210 /*
211 * (non-Javadoc)
212 *
213 * @see
214 * org.eclipse.linuxtools.lttng.event.LttngEvent#setContent(org.eclipse.
215 * linuxtools.lttng.event.LttngEventContent)
216 */
217 @Override
218 public void setContent(LttngEventContent newContent) {
219 if (baseEvent != null) {
220 baseEvent.setContent(newContent);
221 } else {
222 super.setContent(newContent);
223 }
224 }
225
226 /*
227 * (non-Javadoc)
228 *
229 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getType()
230 */
231 @Override
232 public LttngEventType getType() {
233 if (baseEvent != null) {
234 return baseEvent.getType();
235 } else {
236 return super.getType();
237 }
238 }
239
240 /*
241 * (non-Javadoc)
242 *
243 * @see
244 * org.eclipse.linuxtools.lttng.event.LttngEvent#setType(org.eclipse.linuxtools
245 * .lttng.event.LttngEventType)
246 */
247 @Override
248 public void setType(LttngEventType newType) {
249 if (baseEvent != null) {
250 baseEvent.setType(newType);
251 } else {
252 super.setType(newType);
253 }
254 }
255
256 /*
257 * (non-Javadoc)
258 *
259 * @see
260 * org.eclipse.linuxtools.lttng.event.LttngEvent#updateJniEventReference
261 * (org.eclipse.linuxtools.lttng.jni.JniEvent)
262 */
263 @Override
264 public void updateJniEventReference(JniEvent newJniEventReference) {
265 if (baseEvent != null) {
266 baseEvent.updateJniEventReference(newJniEventReference);
267 } else {
268 super.updateJniEventReference(newJniEventReference);
269 }
270 }
271
272 /*
273 * (non-Javadoc)
274 *
275 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#convertEventTmfToJni()
276 */
277 @Override
278 public JniEvent convertEventTmfToJni() {
279 if (baseEvent != null) {
280 return baseEvent.convertEventTmfToJni();
281 } else {
282 return super.convertEventTmfToJni();
283 }
284 }
285
286 /*
287 * (non-Javadoc)
288 *
289 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#isNullRef()
290 */
291 @Override
292 public boolean isNullRef() {
293 return this == NullEvent;
294 }
295
296 /*
297 * (non-Javadoc)
298 *
299 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#toString()
300 */
301 @Override
302 public String toString() {
303 if (baseEvent != null) {
304 return baseEvent.toString();
305 } else {
306 return super.toString();
307 }
308 }
309 }
This page took 0.037473 seconds and 5 git commands to generate.