lttng: Simple warning fixes in lttng2 and ctf
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / trace / TmfExperiment.java
CommitLineData
8c8bf09f 1/*******************************************************************************
0316808c 2 * Copyright (c) 2009, 2010, 2012 Ericsson
ce2388e0 3 *
8c8bf09f
ASL
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
ce2388e0 8 *
8c8bf09f
ASL
9 * Contributors:
10 * Francois Chouinard - Initial API and implementation
0316808c 11 * Francois Chouinard - Updated as per TMF Trace Model 1.0
8c8bf09f
ASL
12 *******************************************************************************/
13
9e0640dc 14package org.eclipse.linuxtools.tmf.core.trace;
8c8bf09f 15
a1091415 16import org.eclipse.core.resources.IFile;
12c155f5 17import org.eclipse.core.resources.IProject;
828e5592 18import org.eclipse.core.resources.IResource;
9e0640dc
FC
19import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentContext;
20import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentLocation;
21import org.eclipse.linuxtools.internal.tmf.core.trace.TmfLocationArray;
72f1e62a 22import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
4df4581d 23import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
6c13869b
FC
24import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
25import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
0316808c 26import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
49e2f79a
FC
27import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
28import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
1b70b6dc 29import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal;
6c13869b
FC
30import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentDisposedSignal;
31import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentRangeUpdatedSignal;
32import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentSelectedSignal;
33import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentUpdatedSignal;
34import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
c32744d6 35import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;
8c8bf09f
ASL
36
37/**
9e0640dc 38 * TmfExperiment presents a time-ordered, unified view of a set of ITmfTrace:s
cbdacf03 39 * that are part of a tracing experiment.
4b7b3670
FC
40 *
41 * @version 1.0
42 * @author Francois Chouinard
8c8bf09f 43 */
0316808c 44public class TmfExperiment<T extends ITmfEvent> extends TmfTrace<T> implements ITmfEventParser<T> {
8c8bf09f 45
c32744d6
FC
46 // ------------------------------------------------------------------------
47 // Constants
48 // ------------------------------------------------------------------------
49
9e0640dc
FC
50 /**
51 * The default index page size
52 */
53 public static final int DEFAULT_INDEX_PAGE_SIZE = 5000;
c32744d6 54
8c8bf09f
ASL
55 // ------------------------------------------------------------------------
56 // Attributes
57 // ------------------------------------------------------------------------
58
9e0640dc
FC
59 /**
60 * The currently selected experiment (null if none)
61 */
c32744d6 62 protected static TmfExperiment<?> fCurrentExperiment = null;
e31e01e8 63
9e0640dc
FC
64 /**
65 * The set of traces that constitute the experiment
66 */
c32744d6 67 protected ITmfTrace<T>[] fTraces;
8c8bf09f 68
9e0640dc
FC
69 /**
70 * The set of traces that constitute the experiment
71 */
72 private boolean fInitialized = false;
a1091415 73
9e0640dc
FC
74 /**
75 * The experiment bookmarks file
76 */
77 private IFile fBookmarksFile;
828e5592 78
49e2f79a
FC
79
80 // Saved experiment context (optimization)
81 private TmfExperimentContext fExperimentContext;
82
8c8bf09f 83 // ------------------------------------------------------------------------
9e0640dc 84 // Construction
8c8bf09f
ASL
85 // ------------------------------------------------------------------------
86
9e0640dc
FC
87 /**
88 * @param type
89 * @param id
90 * @param traces
91 * @throws TmfTraceException
92 */
93 public TmfExperiment(final Class<T> type, final String id, final ITmfTrace<T>[] traces) {
94 this(type, id, traces, DEFAULT_INDEX_PAGE_SIZE);
96c6806f
PT
95 }
96
8c8bf09f
ASL
97 /**
98 * @param type
99 * @param id
100 * @param traces
8c8bf09f 101 * @param indexPageSize
0316808c 102 * @throws TmfTraceException
8c8bf09f 103 */
0316808c 104 @SuppressWarnings({ "unchecked", "rawtypes" })
9e0640dc 105 public TmfExperiment(final Class<T> type, final String path, final ITmfTrace<T>[] traces, final int indexPageSize) {
0316808c
FC
106 setCacheSize(indexPageSize);
107 setStreamingInterval(0);
07671572 108 setIndexer(new TmfCheckpointIndexer(this, indexPageSize));
0316808c
FC
109 setParser(this);
110 try {
111 super.initialize(null, path, type);
112 } catch (TmfTraceException e) {
113 e.printStackTrace();
114 }
8c8bf09f 115
a79913eb 116 fTraces = traces;
a87cc4ef 117 setTimeRange(TmfTimeRange.NULL_RANGE);
8c8bf09f 118 }
a79913eb 119
8c8bf09f 120 /**
ff4ed569 121 * Clears the experiment
8c8bf09f
ASL
122 */
123 @Override
12c155f5 124 @SuppressWarnings("rawtypes")
a79913eb
FC
125 public synchronized void dispose() {
126
cbdacf03 127 final TmfExperimentDisposedSignal<T> signal = new TmfExperimentDisposedSignal<T>(this, this);
a79913eb 128 broadcast(signal);
9e0640dc
FC
129
130 if (fCurrentExperiment == this) {
09d11238 131 fCurrentExperiment = null;
9e0640dc 132 }
a79913eb 133
77551cc2
FC
134 // Clean up the index if applicable
135 if (getIndexer() != null) {
136 getIndexer().dispose();
137 }
b5ee6881 138
a79913eb 139 if (fTraces != null) {
cbdacf03 140 for (final ITmfTrace trace : fTraces)
a79913eb 141 trace.dispose();
a79913eb
FC
142 fTraces = null;
143 }
2fb2eb37 144 super.dispose();
8c8bf09f
ASL
145 }
146
9e0640dc
FC
147 // ------------------------------------------------------------------------
148 // ITmfTrace - Initializers
149 // ------------------------------------------------------------------------
150
151 /* (non-Javadoc)
152 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(org.eclipse.core.resources.IProject, java.lang.String)
153 */
154 @Override
155 public boolean validate(final IProject project, final String path) {
156 return true;
157 }
158
159 /* (non-Javadoc)
160 * @see org.eclipse.linuxtools.tmf.core.trace.TmfTrace#initTrace(org.eclipse.core.resources.IResource, java.lang.String, java.lang.Class)
161 */
162 @Override
163 public void initTrace(final IResource resource, final String path, final Class<T> type) {
164 }
165
8c8bf09f 166 // ------------------------------------------------------------------------
e31e01e8 167 // Accessors
8c8bf09f
ASL
168 // ------------------------------------------------------------------------
169
9e0640dc
FC
170 /**
171 * Selects the current, framework-wide, experiment
172 *
173 * @param experiment das experiment
174 */
cbdacf03 175 public static void setCurrentExperiment(final TmfExperiment<?> experiment) {
9e0640dc 176 if (fCurrentExperiment != null && fCurrentExperiment != experiment) {
09d11238 177 fCurrentExperiment.dispose();
9e0640dc 178 }
a79913eb 179 fCurrentExperiment = experiment;
f6b14ce2
FC
180 }
181
9e0640dc
FC
182 /**
183 * @return das experiment
184 */
e31e01e8 185 public static TmfExperiment<?> getCurrentExperiment() {
a79913eb 186 return fCurrentExperiment;
8c8bf09f
ASL
187 }
188
9e0640dc
FC
189 /**
190 * Get the list of traces. Handle with care...
191 *
192 * @return the experiment traces
193 */
12c155f5 194 public ITmfTrace<T>[] getTraces() {
a79913eb 195 return fTraces;
8c8bf09f
ASL
196 }
197
8c8bf09f 198 /**
cbdacf03
FC
199 * Returns the timestamp of the event at the requested index. If none,
200 * returns null.
a79913eb 201 *
0d9a6d76
FC
202 * @param index the event index (rank)
203 * @return the corresponding event timestamp
8c8bf09f 204 */
cbdacf03 205 public ITmfTimestamp getTimestamp(final int index) {
0316808c 206 final ITmfContext context = seekEvent(index);
c32744d6 207 final ITmfEvent event = getNext(context);
a79913eb 208 return (event != null) ? event.getTimestamp() : null;
8c8bf09f
ASL
209 }
210
9e0640dc
FC
211 /**
212 * Set the file to be used for bookmarks on this experiment
213 *
214 * @param file the bookmarks file
215 */
216 public void setBookmarksFile(final IFile file) {
217 fBookmarksFile = file;
218 }
07671572 219
9e0640dc
FC
220 /**
221 * Get the file used for bookmarks on this experiment
222 *
223 * @return the bookmarks file or null if none is set
224 */
225 public IFile getBookmarksFile() {
226 return fBookmarksFile;
a79913eb
FC
227 }
228
49e2f79a
FC
229 // ------------------------------------------------------------------------
230 // Request management
231 // ------------------------------------------------------------------------
232
3bd44ac8
FC
233 /* (non-Javadoc)
234 * @see org.eclipse.linuxtools.tmf.core.trace.TmfTrace#armRequest(org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest)
235 */
49e2f79a 236 @Override
408e65d2 237 protected synchronized ITmfContext armRequest(final ITmfDataRequest<T> request) {
6a953367
BH
238
239 // Make sure we have something to read from
240 if (fTraces == null) {
241 return null;
242 }
243
49e2f79a
FC
244 if (request instanceof ITmfEventRequest<?>
245 && !TmfTimestamp.BIG_BANG.equals(((ITmfEventRequest<T>) request).getRange().getStartTime())
246 && request.getIndex() == 0)
247 {
248 final ITmfContext context = seekEvent(((ITmfEventRequest<T>) request).getRange().getStartTime());
249 ((ITmfEventRequest<T>) request).setStartIndex((int) context.getRank());
250 return context;
251
252 }
253
254 // Check if we are already at the right index
255 if ((fExperimentContext != null) && fExperimentContext.getRank() == request.getIndex()) {
256 return fExperimentContext;
257 }
258
259 return seekEvent(request.getIndex());
260 }
261
a79913eb 262 // ------------------------------------------------------------------------
9f584e4c
FC
263 // ITmfTrace trace positioning
264 // ------------------------------------------------------------------------
265
f3fd42d1
FC
266 /* (non-Javadoc)
267 * @see org.eclipse.linuxtools.tmf.core.trace.TmfTrace#seekEvent(long)
268 *
269 * TmfTrace.seekEvent(rank) will return a context that will position the
270 * trace to read the event at rank 'rank' in the trace. In the case of an
271 * experiment context, that event has to be actually read in the fEvents
272 * buffer and the corresponding trace context has to point to the next
273 * event (rank + 1) in the trace (the sum of the traces contexts ranks
274 * should equal [exp context rank + #traces] (corner cases not considered).
275 *
276 * In the likely case that TmfTrace.seekEvent() computed the context
277 * by using a read loop (reading from the experiment), the 'lastTraceRead'
278 * field will be set to the actual trace that needs to be read to obtain
279 * event at rank 'rank'.
280 *
281 * Therefore, if 'lastTraceRead' is set, we need to read that particular
282 * trace *and* then decrease the context rank (which has to correspond to
283 * the rank of the event to be returned next by TmfExperiemnt.getNext().
284 */
285 @Override
286 public synchronized ITmfContext seekEvent(final long rank) {
287 TmfExperimentContext context = (TmfExperimentContext) super.seekEvent(rank);
288 int lastTrace = context.getLastTrace();
289 if (lastTrace != TmfExperimentContext.NO_TRACE) {
290 getNext(context);
291 context.setRank(rank);
292 context.setLastTrace(TmfExperimentContext.NO_TRACE);
293 }
294 return context;
295 }
296
9e0640dc
FC
297 /* (non-Javadoc)
298 *
299 * Returns a brand new context based on the location provided and
300 * initializes the event queues
301 *
302 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfLocation)
303 */
a79913eb 304 @Override
9e0640dc 305 public synchronized ITmfContext seekEvent(final ITmfLocation<?> location) {
a79913eb 306 // Validate the location
9e0640dc 307 if (location != null && !(location instanceof TmfExperimentLocation)) {
a79913eb 308 return null; // Throw an exception?
9e0640dc
FC
309 }
310 // Make sure we have something to read from
311 if (fTraces == null) {
a79913eb 312 return null;
9e0640dc 313 }
8f50c396 314
a79913eb 315 // Instantiate the location
9e0640dc 316 final TmfExperimentLocation expLocation = (location == null)
5cc97265 317 ? new TmfExperimentLocation(new TmfLocationArray(new ITmfLocation<?>[fTraces.length]))
9e0640dc 318 : (TmfExperimentLocation) location.clone();
8f50c396 319
a79913eb 320 // Create and populate the context's traces contexts
0316808c 321 final TmfExperimentContext context = new TmfExperimentContext(new ITmfContext[fTraces.length]);
9b635e61 322
a79913eb
FC
323 for (int i = 0; i < fTraces.length; i++) {
324 // Get the relevant trace attributes
5cc97265
FC
325 final ITmfLocation<?> trcLocation = expLocation.getLocation().getLocations()[i];
326 context.getContexts()[i] = fTraces[i].seekEvent(trcLocation);
327 expLocation.getLocation().getLocations()[i] = context.getContexts()[i].getLocation().clone();
c32744d6 328 context.getEvents()[i] = fTraces[i].getNext(context.getContexts()[i]);
a79913eb 329 }
8f50c396 330
a79913eb
FC
331 // Finalize context
332 context.setLocation(expLocation);
333 context.setLastTrace(TmfExperimentContext.NO_TRACE);
5cc97265 334 context.setRank(ITmfContext.UNKNOWN_RANK);
49e2f79a
FC
335
336 fExperimentContext = context;
9e0640dc 337 return (ITmfContext) context;
a79913eb 338 }
9f584e4c 339
3bd44ac8
FC
340 // ------------------------------------------------------------------------
341 // ITmfTrace - SeekEvent operations (returning a trace context)
342 // ------------------------------------------------------------------------
343
9e0640dc
FC
344 /* (non-Javadoc)
345 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(double)
346 */
c76c54bb 347 @Override
0316808c
FC
348 public ITmfContext seekEvent(final double ratio) {
349 final ITmfContext context = seekEvent((long) (ratio * getNbEvents()));
c76c54bb
FC
350 return context;
351 }
352
9e0640dc
FC
353 /* (non-Javadoc)
354 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getLocationRatio(org.eclipse.linuxtools.tmf.core.trace.ITmfLocation)
355 */
a79913eb 356 @Override
cbdacf03 357 public double getLocationRatio(final ITmfLocation<?> location) {
9e0640dc 358 if (location instanceof TmfExperimentLocation) {
5cc97265 359 return (double) seekEvent(location).getRank() / getNbEvents();
9e0640dc
FC
360 }
361 return 0.0;
c76c54bb
FC
362 }
363
9e0640dc
FC
364 /* (non-Javadoc)
365 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCurrentLocation()
366 */
a79913eb
FC
367 @Override
368 public ITmfLocation<?> getCurrentLocation() {
5cc97265 369 ITmfLocation<?>[] locations = new ITmfLocation<?>[fTraces.length];
a87cc4ef 370 for (int i = 0; i < fTraces.length; i++) {
5cc97265 371 locations[i] = fTraces[i].getCurrentLocation();
a87cc4ef
FC
372 }
373 return new TmfExperimentLocation(new TmfLocationArray(locations));
a79913eb 374 }
c76c54bb 375
9e0640dc
FC
376 // ------------------------------------------------------------------------
377 // ITmfTrace trace positioning
378 // ------------------------------------------------------------------------
379
07671572 380 /* (non-Javadoc)
408e65d2 381 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser#parseEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfContext)
07671572
FC
382 */
383 @Override
408e65d2
FC
384 public synchronized T parseEvent(final ITmfContext context) {
385 final ITmfContext savedContext = context.clone();
386 final T event = getNext(savedContext);
07671572
FC
387 return event;
388 }
a79913eb 389
ce2388e0 390 /* (non-Javadoc)
408e65d2 391 * @see org.eclipse.linuxtools.tmf.core.trace.TmfTrace#getNext(org.eclipse.linuxtools.tmf.core.trace.ITmfContext)
a79913eb 392 */
0316808c 393 @Override
3bd44ac8 394 @SuppressWarnings("unchecked")
408e65d2 395 public synchronized T getNext(ITmfContext context) {
a79913eb
FC
396
397 // Validate the context
9e0640dc 398 if (!(context instanceof TmfExperimentContext)) {
a79913eb 399 return null; // Throw an exception?
9e0640dc 400 }
0e8c76f8
BH
401
402 // Make sure that we have something to read from
403 if (fTraces == null) {
404 return null;
405 }
406
a87cc4ef 407 TmfExperimentContext expContext = (TmfExperimentContext) context;
a79913eb 408
a87cc4ef 409 // If an event was consumed previously, first get the next one from that trace
cbdacf03 410 final int lastTrace = expContext.getLastTrace();
a79913eb 411 if (lastTrace != TmfExperimentContext.NO_TRACE) {
cbdacf03 412 final ITmfContext traceContext = expContext.getContexts()[lastTrace];
f3fd42d1
FC
413
414 TmfExperimentLocation location = (TmfExperimentLocation) expContext.getLocation();
415 if (location != null) {
416 location.getLocation().getLocations()[lastTrace] = traceContext.getLocation().clone();
417 }
418
c32744d6 419 expContext.getEvents()[lastTrace] = fTraces[lastTrace].getNext(traceContext);
a79913eb 420 expContext.setLastTrace(TmfExperimentContext.NO_TRACE);
a79913eb
FC
421 }
422
423 // Scan the candidate events and identify the "next" trace to read from
424 int trace = TmfExperimentContext.NO_TRACE;
a4115405 425 ITmfTimestamp timestamp = TmfTimestamp.BIG_CRUNCH;
0316808c 426 for (int i = 0; i < fTraces.length; i++) {
cbdacf03 427 final ITmfEvent event = expContext.getEvents()[i];
a79913eb 428 if (event != null && event.getTimestamp() != null) {
cbdacf03 429 final ITmfTimestamp otherTS = event.getTimestamp();
a79913eb
FC
430 if (otherTS.compareTo(timestamp, true) < 0) {
431 trace = i;
432 timestamp = otherTS;
433 }
434 }
435 }
a87cc4ef
FC
436
437 T event = null;
07671572 438 if (trace != TmfExperimentContext.NO_TRACE) {
a87cc4ef 439 event = (T) expContext.getEvents()[trace];
408e65d2
FC
440 if (event != null) {
441 updateAttributes(expContext, event.getTimestamp());
408e65d2
FC
442 expContext.increaseRank();
443 expContext.setLastTrace(trace);
444 fExperimentContext = expContext;
445 processEvent(event);
446 }
07671572 447 }
a87cc4ef 448
a87cc4ef 449 return event;
a79913eb
FC
450 }
451
bcbea6a6 452 /* (non-Javadoc)
a79913eb
FC
453 * @see java.lang.Object#toString()
454 */
455 @Override
3b38ea61 456 @SuppressWarnings("nls")
a79913eb
FC
457 public String toString() {
458 return "[TmfExperiment (" + getName() + ")]";
459 }
8c8bf09f
ASL
460
461 // ------------------------------------------------------------------------
9e0640dc 462 // Streaming support
8c8bf09f
ASL
463 // ------------------------------------------------------------------------
464
1b70b6dc 465 private synchronized void initializeStreamingMonitor() {
9e0640dc
FC
466
467 if (fInitialized) {
828e5592 468 return;
9e0640dc 469 }
828e5592
PT
470 fInitialized = true;
471
1b70b6dc 472 if (getStreamingInterval() == 0) {
0316808c 473 final ITmfContext context = seekEvent(0);
cbdacf03
FC
474 final ITmfEvent event = getNext(context);
475 if (event == null)
1b70b6dc 476 return;
cbdacf03 477 final TmfTimeRange timeRange = new TmfTimeRange(event.getTimestamp().clone(), TmfTimestamp.BIG_CRUNCH);
828e5592
PT
478 final TmfExperimentRangeUpdatedSignal signal = new TmfExperimentRangeUpdatedSignal(this, this, timeRange);
479
480 // Broadcast in separate thread to prevent deadlock
481 new Thread() {
482 @Override
483 public void run() {
484 broadcast(signal);
485 }
486 }.start();
1b70b6dc
PT
487 return;
488 }
489
9e0640dc 490 final Thread thread = new Thread("Streaming Monitor for experiment " + getName()) { //$NON-NLS-1$
bcbea6a6
FC
491 private ITmfTimestamp safeTimestamp = null;
492 private TmfTimeRange timeRange = null;
1b70b6dc
PT
493
494 @Override
495 public void run() {
496 while (!fExecutor.isShutdown()) {
9e0640dc 497 if (!getIndexer().isIndexing()) {
a4115405
FC
498 ITmfTimestamp startTimestamp = TmfTimestamp.BIG_CRUNCH;
499 ITmfTimestamp endTimestamp = TmfTimestamp.BIG_BANG;
cbdacf03
FC
500 for (final ITmfTrace<T> trace : fTraces) {
501 if (trace.getStartTime().compareTo(startTimestamp) < 0)
1b70b6dc 502 startTimestamp = trace.getStartTime();
cbdacf03 503 if (trace.getStreamingInterval() != 0 && trace.getEndTime().compareTo(endTimestamp) > 0)
1b70b6dc 504 endTimestamp = trace.getEndTime();
1b70b6dc 505 }
cbdacf03 506 if (safeTimestamp != null && safeTimestamp.compareTo(getTimeRange().getEndTime(), false) > 0)
1b70b6dc 507 timeRange = new TmfTimeRange(startTimestamp, safeTimestamp);
cbdacf03 508 else
1b70b6dc 509 timeRange = null;
1b70b6dc
PT
510 safeTimestamp = endTimestamp;
511 if (timeRange != null) {
cbdacf03 512 final TmfExperimentRangeUpdatedSignal signal =
1b70b6dc
PT
513 new TmfExperimentRangeUpdatedSignal(TmfExperiment.this, TmfExperiment.this, timeRange);
514 broadcast(signal);
515 }
516 }
517 try {
518 Thread.sleep(getStreamingInterval());
cbdacf03 519 } catch (final InterruptedException e) {
1b70b6dc
PT
520 e.printStackTrace();
521 }
522 }
523 }
524 };
525 thread.start();
526 }
527
9e0640dc 528 /* (non-Javadoc)
1b70b6dc
PT
529 * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#getStreamingInterval()
530 */
531 @Override
532 public long getStreamingInterval() {
533 long interval = 0;
cbdacf03 534 for (final ITmfTrace<T> trace : fTraces)
1b70b6dc 535 interval = Math.max(interval, trace.getStreamingInterval());
1b70b6dc
PT
536 return interval;
537 }
538
8c8bf09f
ASL
539 // ------------------------------------------------------------------------
540 // Signal handlers
541 // ------------------------------------------------------------------------
542
9e0640dc 543 private Integer fEndSynchReference;
c32744d6 544
9e0640dc
FC
545 /**
546 * Signal handler for the TmfExperimentSelectedSignal signal
547 *
548 * @param signal
549 */
8c8bf09f 550 @TmfSignalHandler
cbdacf03
FC
551 public void experimentSelected(final TmfExperimentSelectedSignal<T> signal) {
552 final TmfExperiment<?> experiment = signal.getExperiment();
a79913eb
FC
553 if (experiment == this) {
554 setCurrentExperiment(experiment);
6e85c58d 555 fEndSynchReference = Integer.valueOf(signal.getReference());
a79913eb 556 }
8c8bf09f
ASL
557 }
558
9e0640dc
FC
559 /**
560 * Signal handler for the TmfEndSynchSignal signal
561 *
562 * @param signal
563 */
1b70b6dc 564 @TmfSignalHandler
cbdacf03 565 public void endSync(final TmfEndSynchSignal signal) {
1b70b6dc
PT
566 if (fEndSynchReference != null && fEndSynchReference.intValue() == signal.getReference()) {
567 fEndSynchReference = null;
568 initializeStreamingMonitor();
569 }
1b70b6dc
PT
570 }
571
828e5592 572 /**
9e0640dc 573 * Signal handler for the TmfTraceUpdatedSignal signal
cbdacf03 574 *
9e0640dc 575 * @param signal
828e5592 576 */
9e0640dc
FC
577 @TmfSignalHandler
578 public void traceUpdated(final TmfTraceUpdatedSignal signal) {
579 if (signal.getTrace() == this) {
580 broadcast(new TmfExperimentUpdatedSignal(this, this));
581 }
a1091415
PT
582 }
583
584 /**
9e0640dc 585 * Signal handler for the TmfExperimentRangeUpdatedSignal signal
cbdacf03 586 *
9e0640dc 587 * @param signal
a1091415 588 */
9e0640dc
FC
589 @TmfSignalHandler
590 public void experimentRangeUpdated(final TmfExperimentRangeUpdatedSignal signal) {
591 if (signal.getExperiment() == this) {
592 getIndexer().buildIndex(getNbEvents(), signal.getRange(), false);
593 }
a1091415
PT
594 }
595
4dc47e28 596}
This page took 0.082643 seconds and 5 git commands to generate.