tmf: Update AbstractTimeGraphView and TimeGraphEntry API
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.analysis.xml.ui / src / org / eclipse / tracecompass / tmf / analysis / xml / ui / views / timegraph / XmlTimeGraphView.java
CommitLineData
1a23419e 1/*******************************************************************************
f8f46a52 2 * Copyright (c) 2014, 2016 École Polytechnique de Montréal
1a23419e
FW
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 * Florian Wininger - Initial API and implementation
11 * Geneviève Bastien - Review of the initial implementation
12 *******************************************************************************/
13
2bdf0193 14package org.eclipse.tracecompass.tmf.analysis.xml.ui.views.timegraph;
1a23419e 15
1d83ed07
AM
16import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
17
1a23419e
FW
18import java.util.ArrayList;
19import java.util.Collections;
20import java.util.Comparator;
21import java.util.HashMap;
836d7c77 22import java.util.HashSet;
1a23419e
FW
23import java.util.LinkedList;
24import java.util.List;
25import java.util.Map;
26import java.util.Set;
27import java.util.TreeSet;
28
29import org.eclipse.core.runtime.IProgressMonitor;
e1c415b3 30import org.eclipse.core.runtime.IStatus;
1a23419e 31import org.eclipse.jdt.annotation.NonNull;
1a23419e
FW
32import org.eclipse.jface.util.IPropertyChangeListener;
33import org.eclipse.jface.util.PropertyChangeEvent;
1a23419e 34import org.eclipse.swt.widgets.Display;
836d7c77 35import org.eclipse.tracecompass.common.core.NonNullUtils;
2bdf0193
AM
36import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.Activator;
37import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.TmfXmlUiStrings;
38import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.XmlViewInfo;
e894a508 39import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
1dd75589 40import org.eclipse.tracecompass.statesystem.core.StateSystemUtils;
e894a508
AM
41import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
42import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
43import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
44import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
45import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
2bdf0193
AM
46import org.eclipse.tracecompass.tmf.analysis.xml.core.model.ITmfXmlModelFactory;
47import org.eclipse.tracecompass.tmf.analysis.xml.core.model.ITmfXmlStateAttribute;
48import org.eclipse.tracecompass.tmf.analysis.xml.core.model.readonly.TmfXmlReadOnlyModelFactory;
49import org.eclipse.tracecompass.tmf.analysis.xml.core.module.IXmlStateSystemContainer;
50import org.eclipse.tracecompass.tmf.analysis.xml.core.module.XmlUtils;
51import org.eclipse.tracecompass.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
52import org.eclipse.tracecompass.tmf.analysis.xml.ui.views.timegraph.XmlEntry.EntryDisplayType;
53import org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems;
2bdf0193
AM
54import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
55import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
b8585c7c 56import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
2bdf0193
AM
57import org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView;
58import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider2;
59import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ILinkEvent;
60import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
61import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
62import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NullTimeEvent;
63import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeEvent;
64import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry;
1a23419e
FW
65import org.w3c.dom.Element;
66
836d7c77
MK
67import com.google.common.collect.Iterables;
68
1a23419e
FW
69/**
70 * This view displays state system data in a time graph view. It uses an XML
71 * {@link TmfXmlUiStrings#TIME_GRAPH_VIEW} element from an XML file. This
72 * element defines which entries from the state system will be shown and also
73 * gives additional information on the presentation of the view (states, colors,
74 * etc)
75 *
76 * @author Florian Wininger
77 */
78public class XmlTimeGraphView extends AbstractTimeGraphView {
79
80 /** View ID. */
35423ee0 81 public static final @NonNull String ID = "org.eclipse.linuxtools.tmf.analysis.xml.ui.views.timegraph"; //$NON-NLS-1$
1a23419e
FW
82
83 private static final String[] DEFAULT_COLUMN_NAMES = new String[] {
84 Messages.XmlTimeGraphView_ColumnName,
85 Messages.XmlTimeGraphView_ColumnId,
86 Messages.XmlTimeGraphView_ColumnParentId,
87 };
88
89 private static final String[] DEFAULT_FILTER_COLUMN_NAMES = new String[] {
90 Messages.XmlTimeGraphView_ColumnName,
91 Messages.XmlTimeGraphView_ColumnId
92 };
93
94 /** The relative weight of the sash */
95 private static final int[] fWeight = { 1, 2 };
96
97 private static final String EMPTY_STRING = ""; //$NON-NLS-1$
8ecd89fa 98 private static final @NonNull String SPLIT_STRING = "/"; //$NON-NLS-1$
1a23419e 99
35423ee0 100 private final @NonNull XmlViewInfo fViewInfo = new XmlViewInfo(ID);
1a23419e
FW
101 private final ITmfXmlModelFactory fFactory;
102
103 // ------------------------------------------------------------------------
104 // Constructors
105 // ------------------------------------------------------------------------
106
107 /**
108 * Default constructor
109 */
110 public XmlTimeGraphView() {
111 super(ID, new XmlPresentationProvider());
112 setWeight(fWeight);
113 setTreeColumns(DEFAULT_COLUMN_NAMES);
114 setTreeLabelProvider(new XmlTreeLabelProvider());
115 setFilterColumns(DEFAULT_FILTER_COLUMN_NAMES);
116 setFilterLabelProvider(new XmlTreeLabelProvider());
117 setEntryComparator(new XmlEntryComparator());
118 this.addPartPropertyListener(new IPropertyChangeListener() {
119 @Override
120 public void propertyChange(PropertyChangeEvent event) {
121 if (event.getProperty().equals(TmfXmlUiStrings.XML_OUTPUT_DATA)) {
35423ee0
GB
122 Object newValue = event.getNewValue();
123 if (newValue instanceof String) {
124 String data = (String) newValue;
125 fViewInfo.setViewData(data);
126 loadNewXmlView();
127 }
1a23419e
FW
128 }
129 }
130 });
1a23419e 131
1a23419e
FW
132 fFactory = TmfXmlReadOnlyModelFactory.getInstance();
133 }
134
1a23419e
FW
135 private void loadNewXmlView() {
136 rebuild();
137 }
138
139 private void setViewTitle(final String title) {
140 Display.getDefault().asyncExec(new Runnable() {
141 @Override
142 public void run() {
143 setPartName(title);
144 }
145 });
146
147 }
148
149 @Override
150 protected String getNextText() {
151 return Messages.XmlTimeGraphView_NextText;
152 }
153
154 @Override
155 protected String getNextTooltip() {
156 return Messages.XmlTimeGraphView_NextTooltip;
157 }
158
159 @Override
160 protected String getPrevText() {
161 return Messages.XmlTimeGraphView_PreviousText;
162 }
163
164 @Override
165 protected String getPrevTooltip() {
166 return Messages.XmlTimeGraphView_PreviousInterval;
167 }
168
169 /**
170 * Default label provider, it shows name, id and parent columns
171 *
172 * TODO: There should be a way to define columns in the XML
836d7c77 173 */
1a23419e
FW
174 private static class XmlTreeLabelProvider extends TreeLabelProvider {
175
176 @Override
177 public String getColumnText(Object element, int columnIndex) {
178 XmlEntry entry = (XmlEntry) element;
179
180 if (DEFAULT_COLUMN_NAMES[columnIndex].equals(Messages.XmlTimeGraphView_ColumnName)) {
181 return entry.getName();
182 } else if (DEFAULT_COLUMN_NAMES[columnIndex].equals(Messages.XmlTimeGraphView_ColumnId)) {
183 return entry.getId();
184 } else if (DEFAULT_COLUMN_NAMES[columnIndex].equals(Messages.XmlTimeGraphView_ColumnParentId)) {
185 return entry.getParentId();
186 }
187 return EMPTY_STRING;
188 }
189
190 }
191
192 private static class XmlEntryComparator implements Comparator<ITimeGraphEntry> {
193
194 @Override
195 public int compare(ITimeGraphEntry o1, ITimeGraphEntry o2) {
196
197 int result = 0;
198
199 if ((o1 instanceof XmlEntry) && (o2 instanceof XmlEntry)) {
200 XmlEntry entry1 = (XmlEntry) o1;
201 XmlEntry entry2 = (XmlEntry) o2;
202 result = entry1.getTrace().getStartTime().compareTo(entry2.getTrace().getStartTime());
203 if (result == 0) {
204 result = entry1.getTrace().getName().compareTo(entry2.getTrace().getName());
205 }
206 if (result == 0) {
207 result = entry1.getName().compareTo(entry2.getName());
208 }
209 }
210
211 if (result == 0) {
212 result = o1.getStartTime() < o2.getStartTime() ? -1 : o1.getStartTime() > o2.getStartTime() ? 1 : 0;
213 }
214
215 return result;
216 }
217 }
218
219 // ------------------------------------------------------------------------
220 // Internal
221 // ------------------------------------------------------------------------
222
223 @Override
f8f46a52 224 protected void buildEntryList(ITmfTrace trace, ITmfTrace parentTrace, IProgressMonitor monitor) {
1a23419e
FW
225
226 /*
227 * Get the view element from the XML file. If the element can't be
228 * found, return.
229 */
35423ee0 230 Element viewElement = fViewInfo.getViewElement(TmfXmlUiStrings.TIME_GRAPH_VIEW);
1a23419e
FW
231 if (viewElement == null) {
232 return;
233 }
234 ITimeGraphPresentationProvider2 pres = this.getPresentationProvider();
235 if (pres instanceof XmlPresentationProvider) {
236 /*
237 * TODO: Each entry of a line could have their own states/color.
238 * That will require an update to the presentation provider
239 */
240 ((XmlPresentationProvider) pres).loadNewStates(viewElement);
241 }
242
35423ee0
GB
243 String title = fViewInfo.getViewTitle(viewElement);
244 if (title == null) {
245 title = Messages.XmlTimeGraphView_DefaultTitle;
1a23419e 246 }
35423ee0
GB
247 setViewTitle(title);
248 Set<String> analysisIds = fViewInfo.getViewAnalysisIds(viewElement);
249
1a23419e
FW
250 List<Element> entries = XmlUtils.getChildElements(viewElement, TmfXmlUiStrings.ENTRY_ELEMENT);
251 Set<XmlEntry> entryList = new TreeSet<>(getEntryComparator());
836d7c77
MK
252 if (monitor.isCanceled()) {
253 return;
254 }
1a23419e 255
aa353506 256 Set<@NonNull ITmfAnalysisModuleWithStateSystems> stateSystemModules = new HashSet<>();
836d7c77
MK
257 if (analysisIds.isEmpty()) {
258 /*
259 * No analysis specified, take all state system analysis modules
260 */
261 Iterables.addAll(stateSystemModules, TmfTraceUtils.getAnalysisModulesOfClass(trace, ITmfAnalysisModuleWithStateSystems.class));
262 } else {
263 for (String moduleId : analysisIds) {
264 moduleId = checkNotNull(moduleId);
265 ITmfAnalysisModuleWithStateSystems module = TmfTraceUtils.getAnalysisModuleOfClass(trace, ITmfAnalysisModuleWithStateSystems.class, moduleId);
266 if (module != null) {
1a23419e
FW
267 stateSystemModules.add(module);
268 }
1a23419e 269 }
836d7c77 270 }
1a23419e 271
836d7c77
MK
272 for (ITmfAnalysisModuleWithStateSystems module : stateSystemModules) {
273 IStatus status = module.schedule();
274 if (!status.isOK()) {
275 return;
276 }
c81ffdf2
JCK
277 if (!module.waitForInitialization()) {
278 return;
836d7c77
MK
279 }
280 for (ITmfStateSystem ssq : module.getStateSystems()) {
281 ssq.waitUntilBuilt();
282
283 long startTime = ssq.getStartTime();
284 long endTime = ssq.getCurrentEndTime();
285 XmlEntry groupEntry = new XmlEntry(-1, trace, trace.getName(), ssq);
286 entryList.add(groupEntry);
287 setStartTime(Math.min(getStartTime(), startTime));
288 setEndTime(Math.max(getEndTime(), endTime));
289
290 /* Add children entry of this entry for each line */
291 for (Element entry : entries) {
292 buildEntry(entry, groupEntry, -1);
1a23419e
FW
293 }
294 }
295 }
836d7c77 296
1a23419e
FW
297 putEntryList(trace, new ArrayList<TimeGraphEntry>(entryList));
298
836d7c77 299 if (parentTrace.equals(getTrace())) {
1a23419e
FW
300 refresh();
301 }
302 for (XmlEntry traceEntry : entryList) {
303 if (monitor.isCanceled()) {
304 return;
305 }
306 long startTime = traceEntry.getStateSystem().getStartTime();
307 long endTime = traceEntry.getStateSystem().getCurrentEndTime() + 1;
308 buildStatusEvent(traceEntry, monitor, startTime, endTime);
309 }
310 }
311
312 private void buildEntry(Element entryElement, XmlEntry parentEntry, int baseQuark) {
313 /* Get the attribute string to display */
314 String path = entryElement.getAttribute(TmfXmlUiStrings.PATH);
315 if (path.isEmpty()) {
316 path = TmfXmlStrings.WILDCARD;
317 }
318
319 /*
320 * Make sure the XML element has either a display attribute or entries,
321 * otherwise issue a warning
322 */
323
324 List<Element> displayElements = XmlUtils.getChildElements(entryElement, TmfXmlUiStrings.DISPLAY_ELEMENT);
325 List<Element> entryElements = XmlUtils.getChildElements(entryElement, TmfXmlUiStrings.ENTRY_ELEMENT);
326
327 if (displayElements.isEmpty() && entryElements.isEmpty()) {
328 Activator.logWarning(String.format("XML view: entry for %s should have either a display element or entry elements", path)); //$NON-NLS-1$
329 return;
330 }
331
332 ITmfStateSystem ss = parentEntry.getStateSystem();
333
334 /* Get the list of quarks to process with this path */
335 String[] paths = path.split(SPLIT_STRING);
336 int i = 0;
337 List<Integer> quarks = Collections.singletonList(baseQuark);
338
339 try {
340 while (i < paths.length) {
341 List<Integer> subQuarks = new LinkedList<>();
342 /* Replace * by .* to have a regex string */
343 String name = paths[i].replaceAll("\\*", ".*"); //$NON-NLS-1$ //$NON-NLS-2$
344 for (int relativeQuark : quarks) {
345 for (int quark : ss.getSubAttributes(relativeQuark, false, name)) {
346 subQuarks.add(quark);
347 }
348 }
349 quarks = subQuarks;
350 i++;
351 }
352
353 /* Process each quark */
354 XmlEntry currentEntry = parentEntry;
355 Element displayElement = null;
356 Map<String, XmlEntry> entryMap = new HashMap<>();
357 if (!displayElements.isEmpty()) {
358 displayElement = displayElements.get(0);
359 }
360 for (int quark : quarks) {
361 currentEntry = parentEntry;
362 /* Process the current entry, if specified */
363 if (displayElement != null) {
364 currentEntry = processEntry(entryElement, displayElement, parentEntry, quark, ss);
365 entryMap.put(currentEntry.getId(), currentEntry);
366 }
367 /* Process the children entry of this entry */
368 for (Element subEntryEl : entryElements) {
369 buildEntry(subEntryEl, currentEntry, quark);
370 }
371 }
372 if (!entryMap.isEmpty()) {
373 buildTree(entryMap, parentEntry);
374 }
375 } catch (AttributeNotFoundException e) {
376 }
377 }
378
379 private XmlEntry processEntry(@NonNull Element entryElement, @NonNull Element displayEl,
12685851 380 @NonNull XmlEntry parentEntry, int quark, ITmfStateSystem ss) {
1a23419e
FW
381 /*
382 * Get the start time and end time of this entry from the display
383 * attribute
384 */
385 ITmfXmlStateAttribute display = fFactory.createStateAttribute(displayEl, parentEntry);
0b563c20 386 int displayQuark = display.getAttributeQuark(quark, null);
1a23419e
FW
387 if (displayQuark == IXmlStateSystemContainer.ERROR_QUARK) {
388 return new XmlEntry(quark, parentEntry.getTrace(),
389 String.format("Unknown display quark for %s", ss.getAttributeName(quark)), ss); //$NON-NLS-1$
390 }
391
392 long entryStart = ss.getStartTime();
393 long entryEnd = ss.getCurrentEndTime();
fadf52eb 394
1a23419e 395 try {
1a23419e 396
fadf52eb 397 ITmfStateInterval oneInterval = ss.querySingleState(entryStart, displayQuark);
1a23419e 398
fadf52eb
FR
399 /* The entry start is the first non-null interval */
400 while (oneInterval.getStateValue().isNull()) {
401 long ts = oneInterval.getEndTime() + 1;
402 if (ts > ss.getCurrentEndTime()) {
403 break;
1a23419e 404 }
fadf52eb 405 oneInterval = ss.querySingleState(ts, displayQuark);
1a23419e 406 }
fadf52eb
FR
407 entryStart = oneInterval.getStartTime();
408
409 /* The entry end is the last non-null interval */
410 oneInterval = ss.querySingleState(entryEnd, displayQuark);
411 while (oneInterval.getStateValue().isNull()) {
412 long ts = oneInterval.getStartTime() - 1;
413 if (ts < ss.getStartTime()) {
414 break;
415 }
416 oneInterval = ss.querySingleState(ts, displayQuark);
417 }
418 entryEnd = oneInterval.getEndTime();
419
1a23419e
FW
420 } catch (AttributeNotFoundException | StateSystemDisposedException e) {
421 }
422
423 return new XmlEntry(quark, displayQuark, parentEntry.getTrace(), ss.getAttributeName(quark),
424 entryStart, entryEnd, EntryDisplayType.DISPLAY, ss, entryElement);
425 }
426
dfa0ef96 427 private void buildStatusEvent(XmlEntry traceEntry, @NonNull IProgressMonitor monitor, long start, long end) {
1a23419e
FW
428 long resolution = (end - start) / getDisplayWidth();
429 long startTime = Math.max(start, traceEntry.getStartTime());
430 long endTime = Math.min(end + 1, traceEntry.getEndTime());
431 List<ITimeEvent> eventList = getEventList(traceEntry, startTime, endTime, resolution, monitor);
432 if (monitor.isCanceled()) {
433 return;
434 }
435 traceEntry.setEventList(eventList);
436 redraw();
437
a3188982 438 for (ITimeGraphEntry entry : traceEntry.getChildren()) {
1a23419e
FW
439 if (monitor.isCanceled()) {
440 return;
441 }
442 XmlEntry xmlEntry = (XmlEntry) entry;
443 buildStatusEvent(xmlEntry, monitor, start, end);
444 }
445 }
446
447 /** Build a tree using getParentId() and getId() */
448 private static void buildTree(Map<String, XmlEntry> entryMap, XmlEntry rootEntry) {
449 for (XmlEntry entry : entryMap.values()) {
450 boolean root = true;
451 if (!entry.getParentId().isEmpty()) {
452 XmlEntry parent = entryMap.get(entry.getParentId());
0a35a36f
GB
453 /*
454 * Associate the parent entry only if their time overlap. A
455 * child entry may start before its parent, for example at the
456 * beginning of the trace if a parent has not yet appeared in
457 * the state system. We just want to make sure that the entry
458 * didn't start after the parent ended or ended before the
459 * parent started.
460 */
1a23419e 461 if (parent != null &&
0a35a36f 462 !(entry.getStartTime() > parent.getEndTime() ||
836d7c77 463 entry.getEndTime() < parent.getStartTime())) {
1a23419e
FW
464 parent.addChild(entry);
465 root = false;
466 }
467 }
468 if (root) {
469 rootEntry.addChild(entry);
470 }
471 }
472 }
473
474 @Override
475 protected List<ITimeEvent> getEventList(TimeGraphEntry entry, long startTime, long endTime, long resolution, IProgressMonitor monitor) {
476 if (!(entry instanceof XmlEntry)) {
477 return Collections.EMPTY_LIST;
478 }
479 XmlEntry xmlEntry = (XmlEntry) entry;
480 ITmfStateSystem ssq = xmlEntry.getStateSystem();
481 final long realStart = Math.max(startTime, entry.getStartTime());
482 final long realEnd = Math.min(endTime, entry.getEndTime());
483 if (realEnd <= realStart) {
484 return null;
485 }
486 List<ITimeEvent> eventList = null;
487 int quark = xmlEntry.getDisplayQuark();
488
489 try {
490 if (xmlEntry.getType() == EntryDisplayType.DISPLAY) {
491
1dd75589 492 List<ITmfStateInterval> statusIntervals = StateSystemUtils.queryHistoryRange(ssq, quark, realStart, realEnd - 1, resolution, monitor);
1a23419e
FW
493 eventList = new ArrayList<>(statusIntervals.size());
494 long lastEndTime = -1;
495 for (ITmfStateInterval statusInterval : statusIntervals) {
496 if (monitor.isCanceled()) {
497 return null;
498 }
499 int status = statusInterval.getStateValue().unboxInt();
500 long time = statusInterval.getStartTime();
501 long duration = statusInterval.getEndTime() - time + 1;
502 if (!statusInterval.getStateValue().isNull()) {
503 if (lastEndTime != time && lastEndTime != -1) {
504 eventList.add(new TimeEvent(entry, lastEndTime, time - lastEndTime));
505 }
506 eventList.add(new TimeEvent(entry, time, duration, status));
507 } else if (lastEndTime == -1 || time + duration >= endTime) {
508 // add null event if it intersects the start or end time
509 eventList.add(new NullTimeEvent(entry, time, duration));
510 }
511 lastEndTime = time + duration;
512 }
513 }
514 } catch (AttributeNotFoundException | TimeRangeException | StateValueTypeException | StateSystemDisposedException e) {
515 /* Ignored */
516 }
517 return eventList;
518 }
519
520 @Override
521 protected List<ILinkEvent> getLinkList(long startTime, long endTime, long resolution, IProgressMonitor monitor) {
522 /* TODO: not implemented yet, need XML to go along */
523 return Collections.EMPTY_LIST;
524 }
525
836d7c77
MK
526 /**
527 * This method will pre-filter the traces that contain analysis modules
528 * supported by this view, whether they are from a trace or an experiment.
529 */
530 @Override
531 protected Iterable<ITmfTrace> getTracesToBuild(ITmfTrace trace) {
532 /*
533 * Get the view element from the XML file. If the element can't be
534 * found, return.
535 */
536 Element viewElement = fViewInfo.getViewElement(TmfXmlUiStrings.TIME_GRAPH_VIEW);
537 if (viewElement == null) {
538 return super.getTracesToBuild(trace);
539 }
540
541 Set<String> analysisIds = fViewInfo.getViewAnalysisIds(viewElement);
542 Set<ITmfTrace> traces = new HashSet<>();
543
544 for (ITmfTrace aTrace : TmfTraceManager.getTraceSetWithExperiment(trace)) {
545 if (aTrace == null) {
546 continue;
547 }
548 if ((analysisIds.isEmpty() && TmfTraceUtils.getAnalysisModulesOfClass(aTrace, ITmfAnalysisModuleWithStateSystems.class).iterator().hasNext())) {
549 /*
550 * No analysis ID specified, so this trace will be built only if
551 * it has state system modules
552 */
553 traces.add(aTrace);
554 } else {
555 /* Build this trace only if it has one the requested modules */
556 for (String moduleId : analysisIds) {
557 if (TmfTraceUtils.getAnalysisModuleOfClass(aTrace, ITmfAnalysisModuleWithStateSystems.class, NonNullUtils.checkNotNull(moduleId)) != null) {
558 traces.add(aTrace);
559 }
560 }
561 }
562 }
563 if (traces.isEmpty()) {
564 return super.getTracesToBuild(trace);
565 }
566 return traces;
567 }
1a23419e 568}
This page took 0.085532 seconds and 5 git commands to generate.