Commit | Line | Data |
---|---|---|
c068a752 GB |
1 | /******************************************************************************* |
2 | * Copyright (c) 2013 École Polytechnique de Montréal | |
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 | * Geneviève Bastien - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.tmf.tests.stubs.analysis; | |
14 | ||
15 | import org.eclipse.linuxtools.tmf.core.analysis.TmfAbstractAnalysisParamProvider; | |
16 | import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace; | |
17 | import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub; | |
18 | ||
19 | /** | |
20 | * Test parameter provider for the PARAM_TEST that would apply only to | |
21 | * CtfTmfTrace (though it is associated with an analysis that supports all trace | |
22 | * types) | |
23 | * | |
24 | * @author Geneviève Bastien | |
25 | */ | |
26 | public class TestAnalysisParameterProvider extends TmfAbstractAnalysisParamProvider { | |
27 | ||
28 | private int fValue = 10; | |
29 | ||
30 | @Override | |
31 | public String getName() { | |
32 | return "test parameter provider"; | |
33 | } | |
34 | ||
35 | @Override | |
36 | public Object getParameter(String name) { | |
37 | if (name.equals(TestAnalysis.PARAM_TEST)) { | |
38 | return fValue; | |
39 | } | |
40 | return null; | |
41 | } | |
42 | ||
43 | @Override | |
44 | public boolean appliesToTrace(ITmfTrace trace) { | |
45 | return (trace instanceof TmfTraceStub); | |
46 | } | |
47 | ||
48 | /** | |
49 | * Sets a new value for the parameter | |
50 | * | |
51 | * @param value | |
52 | * new parameter value | |
53 | */ | |
54 | public void setValue(int value) { | |
55 | fValue = value; | |
56 | notifyParameterChanged(TestAnalysis.PARAM_TEST); | |
57 | } | |
58 | ||
59 | } |