1 /*******************************************************************************
2 * Copyright (c) 2013 É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 org
.eclipse
.tracecompass
.statesystem
.core
.exceptions
.AttributeNotFoundException
;
16 import org
.eclipse
.tracecompass
.statesystem
.core
.exceptions
.StateValueTypeException
;
17 import org
.eclipse
.tracecompass
.statesystem
.core
.exceptions
.TimeRangeException
;
18 import org
.eclipse
.tracecompass
.statesystem
.core
.statevalue
.TmfStateValue
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
20 import org
.eclipse
.tracecompass
.tmf
.core
.event
.TmfEvent
;
21 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.AbstractTmfStateProvider
;
22 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.ITmfStateProvider
;
23 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
26 * Stub test provider for test state system analysis module
28 * @author Geneviève Bastien
30 public class TestStateSystemProvider
extends AbstractTmfStateProvider
{
32 private static final int VERSION
= 1;
33 private final String fString
= "[]";
34 private int fCount
= 0;
40 * The LTTng 2.0 kernel trace directory
42 public TestStateSystemProvider(ITmfTrace trace
) {
43 super(trace
, TmfEvent
.class, "Stub State System");
47 public int getVersion() {
52 public ITmfStateProvider
getNewInstance() {
53 return new TestStateSystemProvider(this.getTrace());
57 protected void eventHandle(ITmfEvent event
) {
58 /* Just need something to fill the state system */
59 if (fString
.equals(event
.getContent().getValue())) {
61 int quarkId
= ss
.getQuarkAbsoluteAndAdd("String");
62 int quark
= ss
.getQuarkRelativeAndAdd(quarkId
, fString
);
63 ss
.modifyAttribute(event
.getTimestamp().getValue(), TmfStateValue
.newValueInt(fCount
++), quark
);
64 } catch (TimeRangeException e
) {
66 } catch (AttributeNotFoundException e
) {
68 } catch (StateValueTypeException e
) {