1 /*******************************************************************************
2 * Copyright (c) 2013, 2015 École Polytechnique de Montréal
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
10 * Geneviève Bastien - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.tmf
.tests
.stubs
.analysis
;
15 import static org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
.checkNotNull
;
17 import org
.eclipse
.jdt
.annotation
.NonNullByDefault
;
18 import org
.eclipse
.jdt
.annotation
.Nullable
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.ITmfStateProvider
;
20 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.TmfStateSystemAnalysisModule
;
23 * Test State System module
25 * @author Geneviève Bastien
28 public class TestStateSystemModule
extends TmfStateSystemAnalysisModule
{
30 private @Nullable TestStateSystemProvider fProvider
= null;
31 private boolean fThrottleEvents
= false;
34 protected ITmfStateProvider
createStateProvider() {
36 TestStateSystemProvider provider
= new TestStateSystemProvider(checkNotNull(getTrace()));
38 boolean throttle
= fThrottleEvents
;
39 provider
.setThrottling(throttle
);
44 protected StateSystemBackendType
getBackendType() {
45 return StateSystemBackendType
.INMEM
;
49 * Get the name of the backend
51 * @return The name of the backend used
53 public String
getBackendName() {
54 return StateSystemBackendType
.INMEM
.name();
58 * Set whether events are processed one at a time
60 * @param throttleEvent A value of <code>true</code> will have the events processed one a time instead of adding them all to the queue. To process the next event, one must call the {@link #signalNextEvent()} method. A value of <code>false</code> will return to default behavior.
62 public void setPerEventSignalling(boolean throttleEvent
) {
63 fThrottleEvents
= throttleEvent
;
64 TestStateSystemProvider provider
= fProvider
;
65 if (provider
!= null) {
66 provider
.setThrottling(throttleEvent
);
71 * Signal for the next event to be processed. This makes sense only if
72 * {@link #setPerEventSignalling(boolean)} method has been set to true
74 public void signalNextEvent() {
75 TestStateSystemProvider provider
= fProvider
;
76 if (provider
!= null) {
77 provider
.signalNextEvent();