Change ITmfTrace<T extends TmfEvent> to ITmfTrace<T extends ITmfEvent>
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui.tests / stubs / org / eclipse / linuxtools / lttng / stubs / LTTngEventParserStub.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 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.lttng.stubs;
14
15 import java.io.IOException;
16
17 import org.eclipse.linuxtools.lttng.core.event.LttngEvent;
18 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
19 import org.eclipse.linuxtools.tmf.core.parser.ITmfEventParser;
20 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
21 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
22
23 /**
24 * <b><u>TmfEventParserStub</u></b>
25 * <p>
26 * TODO: Implement me. Please.
27 */
28 public class LTTngEventParserStub implements ITmfEventParser<LttngEvent> {
29
30 /* (non-Javadoc)
31 * @see org.eclipse.linuxtools.tmf.core.parser.ITmfEventParser#parseNextEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfTrace, org.eclipse.linuxtools.tmf.core.trace.TmfContext)
32 */
33 @Override
34 public ITmfEvent parseNextEvent(ITmfTrace<LttngEvent> stream, TmfContext context)
35 throws IOException {
36 // TODO Auto-generated method stub
37 return null;
38 }
39
40 // // ========================================================================
41 // // Attributes
42 // // ========================================================================
43 //
44 // private final int NB_FORMATS = 10;
45 // private final TmfEventFormat[] fFormats;
46 //
47 // // ========================================================================
48 // // Constructors
49 // // ========================================================================
50 //
51 // public LTTngEventParserStub() {
52 // fFormats = new TmfEventFormat[NB_FORMATS];
53 // for (int i = 0; i < NB_FORMATS; i++) {
54 // Vector<String> format = new Vector<String>();
55 // for (int j = 1; j <= i; j++) {
56 // format.add(new String("Fmt-" + i + "-Fld-" + j));
57 // }
58 // String[] fields = new String[i];
59 // fFormats[i] = new TmfEventFormat(format.toArray(fields));
60 // }
61 // }
62 //
63 // // ========================================================================
64 // // Accessors
65 // // ========================================================================
66 //
67 // // ========================================================================
68 // // Operators
69 // // ========================================================================
70 //
71 // /* (non-Javadoc)
72 // * @see org.eclipse.linuxtools.tmf.eventlog.ITmfEventParser#parseNextEvent()
73 // */
74 // static final String typePrefix = "Type-";
75 // public TmfEvent parseNextEvent(ITmfTrace eventStream, TmfTraceContext context) throws IOException {
76 //
77 // if (! (eventStream instanceof LTTngTraceStub)) {
78 // return null;
79 // }
80 //
81 // // Highly inefficient...
82 // RandomAccessFile stream = ((LTTngTraceStub) eventStream).getStream();
83 // String name = eventStream.getName();
84 // name = name.substring(name.lastIndexOf('/') + 1);
85 //
86 // synchronized(stream) {
87 // long location = 0;
88 // if (context != null)
89 // location = (Long) (context.getLocation());
90 // stream.seek(location);
91 //
92 // try {
93 // // Read the individual fields
94 // long ts = stream.readLong();
95 // String source = stream.readUTF();
96 // String type = stream.readUTF();
97 // @SuppressWarnings("unused")
98 // int reference = stream.readInt();
99 //
100 // // Read the event parts
101 // int typeIndex = Integer.parseInt(type.substring(typePrefix.length()));
102 // String[] fields = new String[typeIndex];
103 // for (int i = 0; i < typeIndex; i++) {
104 // fields[i] = stream.readUTF();
105 // }
106 //
107 // // Format the content from the individual fields
108 // String content = "[";
109 // if (typeIndex > 0) {
110 // content += fields[0];
111 // }
112 // for (int i = 1; i < typeIndex; i++) {
113 // content += ", " + fields[i];
114 // }
115 // content += "]";
116 //
117 // // Update the context
118 // context.setLocation(stream.getFilePointer());
119 // context.incrIndex();
120 // try {
121 // long ts2 = stream.readLong();
122 // context.setTimestamp(new LTTngTimestampStub(ts2));
123 // } catch (EOFException e) {
124 // context.setTimestamp(null);
125 // }
126 //
127 // // Create the event
128 // TmfEvent event = new TmfEvent(
129 // new LTTngTimestampStub(ts),
130 // new TmfEventSource(source),
131 // new TmfEventType(type, fFormats[typeIndex]),
132 // new TmfEventContent(content, fFormats[typeIndex]),
133 // new TmfEventReference(name));
134 //
135 // return event;
136 //
137 // } catch (EOFException e) {
138 // context.setTimestamp(null);
139 // }
140 // }
141 // return null;
142 // }
143
144 }
This page took 0.033999 seconds and 5 git commands to generate.