Use project-specific Save Actions settings
[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
9b749023 91 * @throws TmfTraceException
9e0640dc
FC
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
9b749023 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) {
9b749023 140 for (final ITmfTrace trace : fTraces) {
a79913eb 141 trace.dispose();
9b749023 142 }
a79913eb
FC
143 fTraces = null;
144 }
2fb2eb37 145 super.dispose();
8c8bf09f
ASL
146 }
147
9e0640dc
FC
148 // ------------------------------------------------------------------------
149 // ITmfTrace - Initializers
150 // ------------------------------------------------------------------------
151
152 /* (non-Javadoc)
17324c9a 153 * @see org.eclipse.linuxtools.tmf.core.trace.TmfTrace#initTrace(org.eclipse.core.resources.IResource, java.lang.String, java.lang.Class)
9e0640dc
FC
154 */
155 @Override
17324c9a 156 public void initTrace(final IResource resource, final String path, final Class<T> type) {
9e0640dc
FC
157 }
158
159 /* (non-Javadoc)
17324c9a 160 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(org.eclipse.core.resources.IProject, java.lang.String)
9e0640dc
FC
161 */
162 @Override
17324c9a
FC
163 public boolean validate(final IProject project, final String path) {
164 return true;
9e0640dc
FC
165 }
166
8c8bf09f 167 // ------------------------------------------------------------------------
e31e01e8 168 // Accessors
8c8bf09f
ASL
169 // ------------------------------------------------------------------------
170
9e0640dc
FC
171 /**
172 * Selects the current, framework-wide, experiment
9b749023 173 *
9e0640dc
FC
174 * @param experiment das experiment
175 */
cbdacf03 176 public static void setCurrentExperiment(final TmfExperiment<?> experiment) {
9e0640dc 177 if (fCurrentExperiment != null && fCurrentExperiment != experiment) {
09d11238 178 fCurrentExperiment.dispose();
9e0640dc 179 }
a79913eb 180 fCurrentExperiment = experiment;
f6b14ce2
FC
181 }
182
9e0640dc
FC
183 /**
184 * @return das experiment
185 */
e31e01e8 186 public static TmfExperiment<?> getCurrentExperiment() {
a79913eb 187 return fCurrentExperiment;
8c8bf09f
ASL
188 }
189
9e0640dc
FC
190 /**
191 * Get the list of traces. Handle with care...
9b749023 192 *
9e0640dc
FC
193 * @return the experiment traces
194 */
12c155f5 195 public ITmfTrace<T>[] getTraces() {
a79913eb 196 return fTraces;
8c8bf09f
ASL
197 }
198
8c8bf09f 199 /**
cbdacf03
FC
200 * Returns the timestamp of the event at the requested index. If none,
201 * returns null.
9b749023 202 *
0d9a6d76
FC
203 * @param index the event index (rank)
204 * @return the corresponding event timestamp
8c8bf09f 205 */
cbdacf03 206 public ITmfTimestamp getTimestamp(final int index) {
0316808c 207 final ITmfContext context = seekEvent(index);
c32744d6 208 final ITmfEvent event = getNext(context);
a79913eb 209 return (event != null) ? event.getTimestamp() : null;
8c8bf09f
ASL
210 }
211
9e0640dc
FC
212 /**
213 * Set the file to be used for bookmarks on this experiment
9b749023 214 *
9e0640dc
FC
215 * @param file the bookmarks file
216 */
217 public void setBookmarksFile(final IFile file) {
218 fBookmarksFile = file;
219 }
07671572 220
9e0640dc
FC
221 /**
222 * Get the file used for bookmarks on this experiment
9b749023 223 *
9e0640dc
FC
224 * @return the bookmarks file or null if none is set
225 */
226 public IFile getBookmarksFile() {
227 return fBookmarksFile;
a79913eb
FC
228 }
229
49e2f79a
FC
230 // ------------------------------------------------------------------------
231 // Request management
232 // ------------------------------------------------------------------------
233
3bd44ac8
FC
234 /* (non-Javadoc)
235 * @see org.eclipse.linuxtools.tmf.core.trace.TmfTrace#armRequest(org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest)
236 */
49e2f79a 237 @Override
408e65d2 238 protected synchronized ITmfContext armRequest(final ITmfDataRequest<T> request) {
9b749023 239
6a953367
BH
240 // Make sure we have something to read from
241 if (fTraces == null) {
242 return null;
243 }
9b749023 244
49e2f79a
FC
245 if (request instanceof ITmfEventRequest<?>
246 && !TmfTimestamp.BIG_BANG.equals(((ITmfEventRequest<T>) request).getRange().getStartTime())
247 && request.getIndex() == 0)
248 {
249 final ITmfContext context = seekEvent(((ITmfEventRequest<T>) request).getRange().getStartTime());
250 ((ITmfEventRequest<T>) request).setStartIndex((int) context.getRank());
251 return context;
252
253 }
254
255 // Check if we are already at the right index
256 if ((fExperimentContext != null) && fExperimentContext.getRank() == request.getIndex()) {
257 return fExperimentContext;
258 }
259
260 return seekEvent(request.getIndex());
261 }
262
a79913eb 263 // ------------------------------------------------------------------------
9f584e4c
FC
264 // ITmfTrace trace positioning
265 // ------------------------------------------------------------------------
266
9e0640dc
FC
267 /* (non-Javadoc)
268 *
9b749023 269 * Returns a brand new context based on the location provided and
9e0640dc 270 * initializes the event queues
9b749023 271 *
9e0640dc
FC
272 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfLocation)
273 */
a79913eb 274 @Override
9e0640dc 275 public synchronized ITmfContext seekEvent(final ITmfLocation<?> location) {
a79913eb 276 // Validate the location
9e0640dc 277 if (location != null && !(location instanceof TmfExperimentLocation)) {
a79913eb 278 return null; // Throw an exception?
9e0640dc
FC
279 }
280 // Make sure we have something to read from
281 if (fTraces == null) {
a79913eb 282 return null;
9e0640dc 283 }
8f50c396 284
a79913eb 285 // Instantiate the location
9e0640dc 286 final TmfExperimentLocation expLocation = (location == null)
9b749023 287 ? new TmfExperimentLocation(new TmfLocationArray(new ITmfLocation<?>[fTraces.length]))
9e0640dc 288 : (TmfExperimentLocation) location.clone();
8f50c396 289
a79913eb 290 // Create and populate the context's traces contexts
0316808c 291 final TmfExperimentContext context = new TmfExperimentContext(new ITmfContext[fTraces.length]);
9b635e61 292
a79913eb
FC
293 for (int i = 0; i < fTraces.length; i++) {
294 // Get the relevant trace attributes
5cc97265
FC
295 final ITmfLocation<?> trcLocation = expLocation.getLocation().getLocations()[i];
296 context.getContexts()[i] = fTraces[i].seekEvent(trcLocation);
297 expLocation.getLocation().getLocations()[i] = context.getContexts()[i].getLocation().clone();
c32744d6 298 context.getEvents()[i] = fTraces[i].getNext(context.getContexts()[i]);
a79913eb 299 }
8f50c396 300
a79913eb
FC
301 // Finalize context
302 context.setLocation(expLocation);
303 context.setLastTrace(TmfExperimentContext.NO_TRACE);
17324c9a 304 context.setRank((location == null) ? 0 : ITmfContext.UNKNOWN_RANK);
49e2f79a
FC
305
306 fExperimentContext = context;
9b749023 307 return context;
a79913eb 308 }
9f584e4c 309
3bd44ac8
FC
310 // ------------------------------------------------------------------------
311 // ITmfTrace - SeekEvent operations (returning a trace context)
312 // ------------------------------------------------------------------------
313
9e0640dc
FC
314 /* (non-Javadoc)
315 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(double)
316 */
c76c54bb 317 @Override
0316808c
FC
318 public ITmfContext seekEvent(final double ratio) {
319 final ITmfContext context = seekEvent((long) (ratio * getNbEvents()));
c76c54bb
FC
320 return context;
321 }
322
9e0640dc
FC
323 /* (non-Javadoc)
324 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getLocationRatio(org.eclipse.linuxtools.tmf.core.trace.ITmfLocation)
325 */
a79913eb 326 @Override
cbdacf03 327 public double getLocationRatio(final ITmfLocation<?> location) {
9e0640dc 328 if (location instanceof TmfExperimentLocation) {
5cc97265 329 return (double) seekEvent(location).getRank() / getNbEvents();
9e0640dc
FC
330 }
331 return 0.0;
c76c54bb
FC
332 }
333
9e0640dc
FC
334 /* (non-Javadoc)
335 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCurrentLocation()
336 */
a79913eb
FC
337 @Override
338 public ITmfLocation<?> getCurrentLocation() {
5cc97265 339 ITmfLocation<?>[] locations = new ITmfLocation<?>[fTraces.length];
a87cc4ef 340 for (int i = 0; i < fTraces.length; i++) {
5cc97265 341 locations[i] = fTraces[i].getCurrentLocation();
a87cc4ef
FC
342 }
343 return new TmfExperimentLocation(new TmfLocationArray(locations));
a79913eb 344 }
c76c54bb 345
9e0640dc
FC
346 // ------------------------------------------------------------------------
347 // ITmfTrace trace positioning
348 // ------------------------------------------------------------------------
349
07671572 350 /* (non-Javadoc)
408e65d2 351 * @see org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser#parseEvent(org.eclipse.linuxtools.tmf.core.trace.ITmfContext)
07671572
FC
352 */
353 @Override
408e65d2
FC
354 public synchronized T parseEvent(final ITmfContext context) {
355 final ITmfContext savedContext = context.clone();
356 final T event = getNext(savedContext);
07671572
FC
357 return event;
358 }
a79913eb 359
ce2388e0 360 /* (non-Javadoc)
408e65d2 361 * @see org.eclipse.linuxtools.tmf.core.trace.TmfTrace#getNext(org.eclipse.linuxtools.tmf.core.trace.ITmfContext)
a79913eb 362 */
0316808c 363 @Override
3bd44ac8 364 @SuppressWarnings("unchecked")
408e65d2 365 public synchronized T getNext(ITmfContext context) {
a79913eb
FC
366
367 // Validate the context
9e0640dc 368 if (!(context instanceof TmfExperimentContext)) {
a79913eb 369 return null; // Throw an exception?
9e0640dc 370 }
0e8c76f8
BH
371
372 // Make sure that we have something to read from
373 if (fTraces == null) {
374 return null;
375 }
376
a87cc4ef 377 TmfExperimentContext expContext = (TmfExperimentContext) context;
a79913eb 378
a87cc4ef 379 // If an event was consumed previously, first get the next one from that trace
cbdacf03 380 final int lastTrace = expContext.getLastTrace();
a79913eb 381 if (lastTrace != TmfExperimentContext.NO_TRACE) {
cbdacf03 382 final ITmfContext traceContext = expContext.getContexts()[lastTrace];
c32744d6 383 expContext.getEvents()[lastTrace] = fTraces[lastTrace].getNext(traceContext);
a79913eb 384 expContext.setLastTrace(TmfExperimentContext.NO_TRACE);
a79913eb
FC
385 }
386
387 // Scan the candidate events and identify the "next" trace to read from
388 int trace = TmfExperimentContext.NO_TRACE;
a4115405 389 ITmfTimestamp timestamp = TmfTimestamp.BIG_CRUNCH;
0316808c 390 for (int i = 0; i < fTraces.length; i++) {
cbdacf03 391 final ITmfEvent event = expContext.getEvents()[i];
a79913eb 392 if (event != null && event.getTimestamp() != null) {
cbdacf03 393 final ITmfTimestamp otherTS = event.getTimestamp();
a79913eb
FC
394 if (otherTS.compareTo(timestamp, true) < 0) {
395 trace = i;
396 timestamp = otherTS;
397 }
398 }
399 }
a87cc4ef
FC
400
401 T event = null;
07671572 402 if (trace != TmfExperimentContext.NO_TRACE) {
a87cc4ef 403 event = (T) expContext.getEvents()[trace];
408e65d2
FC
404 if (event != null) {
405 updateAttributes(expContext, event.getTimestamp());
408e65d2
FC
406 expContext.increaseRank();
407 expContext.setLastTrace(trace);
17324c9a
FC
408 final ITmfContext traceContext = expContext.getContexts()[trace];
409
410 TmfExperimentLocation location = (TmfExperimentLocation) expContext.getLocation();
411 if (location != null) {
412 location.getLocation().getLocations()[trace] = traceContext.getLocation().clone();
413 }
414
415 fExperimentContext = expContext.clone();
408e65d2
FC
416 processEvent(event);
417 }
07671572 418 }
a87cc4ef 419
a87cc4ef 420 return event;
a79913eb
FC
421 }
422
bcbea6a6 423 /* (non-Javadoc)
a79913eb
FC
424 * @see java.lang.Object#toString()
425 */
426 @Override
3b38ea61 427 @SuppressWarnings("nls")
9b749023 428 public synchronized String toString() {
a79913eb
FC
429 return "[TmfExperiment (" + getName() + ")]";
430 }
8c8bf09f
ASL
431
432 // ------------------------------------------------------------------------
9e0640dc 433 // Streaming support
8c8bf09f
ASL
434 // ------------------------------------------------------------------------
435
1b70b6dc 436 private synchronized void initializeStreamingMonitor() {
9e0640dc
FC
437
438 if (fInitialized) {
828e5592 439 return;
9e0640dc 440 }
828e5592
PT
441 fInitialized = true;
442
1b70b6dc 443 if (getStreamingInterval() == 0) {
0316808c 444 final ITmfContext context = seekEvent(0);
cbdacf03 445 final ITmfEvent event = getNext(context);
9b749023 446 if (event == null) {
1b70b6dc 447 return;
9b749023 448 }
cbdacf03 449 final TmfTimeRange timeRange = new TmfTimeRange(event.getTimestamp().clone(), TmfTimestamp.BIG_CRUNCH);
828e5592
PT
450 final TmfExperimentRangeUpdatedSignal signal = new TmfExperimentRangeUpdatedSignal(this, this, timeRange);
451
452 // Broadcast in separate thread to prevent deadlock
453 new Thread() {
454 @Override
455 public void run() {
456 broadcast(signal);
457 }
458 }.start();
1b70b6dc
PT
459 return;
460 }
461
9e0640dc 462 final Thread thread = new Thread("Streaming Monitor for experiment " + getName()) { //$NON-NLS-1$
bcbea6a6 463 private ITmfTimestamp safeTimestamp = null;
6be2d5cc 464 private ITmfTimestamp lastSafeTimestamp = null;
bcbea6a6 465 private TmfTimeRange timeRange = null;
1b70b6dc
PT
466
467 @Override
468 public void run() {
469 while (!fExecutor.isShutdown()) {
9e0640dc 470 if (!getIndexer().isIndexing()) {
a4115405
FC
471 ITmfTimestamp startTimestamp = TmfTimestamp.BIG_CRUNCH;
472 ITmfTimestamp endTimestamp = TmfTimestamp.BIG_BANG;
cbdacf03 473 for (final ITmfTrace<T> trace : fTraces) {
9b749023 474 if (trace.getStartTime().compareTo(startTimestamp) < 0) {
1b70b6dc 475 startTimestamp = trace.getStartTime();
9b749023
AM
476 }
477 if (trace.getStreamingInterval() != 0 && trace.getEndTime().compareTo(endTimestamp) > 0) {
1b70b6dc 478 endTimestamp = trace.getEndTime();
9b749023 479 }
1b70b6dc 480 }
6be2d5cc 481 if (safeTimestamp != null && (lastSafeTimestamp == null || safeTimestamp.compareTo(lastSafeTimestamp, false) > 0)) {
1b70b6dc 482 timeRange = new TmfTimeRange(startTimestamp, safeTimestamp);
6be2d5cc 483 lastSafeTimestamp = safeTimestamp;
9b749023 484 } else {
1b70b6dc 485 timeRange = null;
9b749023 486 }
1b70b6dc
PT
487 safeTimestamp = endTimestamp;
488 if (timeRange != null) {
cbdacf03 489 final TmfExperimentRangeUpdatedSignal signal =
1b70b6dc
PT
490 new TmfExperimentRangeUpdatedSignal(TmfExperiment.this, TmfExperiment.this, timeRange);
491 broadcast(signal);
492 }
493 }
494 try {
495 Thread.sleep(getStreamingInterval());
cbdacf03 496 } catch (final InterruptedException e) {
1b70b6dc
PT
497 e.printStackTrace();
498 }
499 }
500 }
501 };
502 thread.start();
503 }
504
9e0640dc 505 /* (non-Javadoc)
1b70b6dc
PT
506 * @see org.eclipse.linuxtools.tmf.trace.ITmfTrace#getStreamingInterval()
507 */
508 @Override
509 public long getStreamingInterval() {
510 long interval = 0;
9b749023 511 for (final ITmfTrace<T> trace : fTraces) {
1b70b6dc 512 interval = Math.max(interval, trace.getStreamingInterval());
9b749023 513 }
1b70b6dc
PT
514 return interval;
515 }
516
8c8bf09f
ASL
517 // ------------------------------------------------------------------------
518 // Signal handlers
519 // ------------------------------------------------------------------------
520
9e0640dc 521 private Integer fEndSynchReference;
c32744d6 522
9e0640dc
FC
523 /**
524 * Signal handler for the TmfExperimentSelectedSignal signal
9b749023 525 *
063f0d27 526 * @param signal The incoming signal
9e0640dc 527 */
8c8bf09f 528 @TmfSignalHandler
cbdacf03
FC
529 public void experimentSelected(final TmfExperimentSelectedSignal<T> signal) {
530 final TmfExperiment<?> experiment = signal.getExperiment();
a79913eb
FC
531 if (experiment == this) {
532 setCurrentExperiment(experiment);
6e85c58d 533 fEndSynchReference = Integer.valueOf(signal.getReference());
a79913eb 534 }
8c8bf09f
ASL
535 }
536
9e0640dc
FC
537 /**
538 * Signal handler for the TmfEndSynchSignal signal
9b749023 539 *
063f0d27 540 * @param signal The incoming signal
9e0640dc 541 */
1b70b6dc 542 @TmfSignalHandler
cbdacf03 543 public void endSync(final TmfEndSynchSignal signal) {
1b70b6dc
PT
544 if (fEndSynchReference != null && fEndSynchReference.intValue() == signal.getReference()) {
545 fEndSynchReference = null;
546 initializeStreamingMonitor();
547 }
1b70b6dc
PT
548 }
549
828e5592 550 /**
9e0640dc 551 * Signal handler for the TmfTraceUpdatedSignal signal
9b749023 552 *
063f0d27 553 * @param signal The incoming signal
828e5592 554 */
9e0640dc
FC
555 @TmfSignalHandler
556 public void traceUpdated(final TmfTraceUpdatedSignal signal) {
557 if (signal.getTrace() == this) {
558 broadcast(new TmfExperimentUpdatedSignal(this, this));
559 }
a1091415
PT
560 }
561
562 /**
9e0640dc 563 * Signal handler for the TmfExperimentRangeUpdatedSignal signal
9b749023 564 *
063f0d27 565 * @param signal The incoming signal
a1091415 566 */
9e0640dc
FC
567 @TmfSignalHandler
568 public void experimentRangeUpdated(final TmfExperimentRangeUpdatedSignal signal) {
569 if (signal.getExperiment() == this) {
570 getIndexer().buildIndex(getNbEvents(), signal.getRange(), false);
571 }
a1091415
PT
572 }
573
4dc47e28 574}
This page took 0.084769 seconds and 5 git commands to generate.