tmf : Add pattern analysis behavior
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.analysis.xml.core / src / org / eclipse / tracecompass / tmf / analysis / xml / core / model / ResetStoredFieldsAction.java
1 /*******************************************************************************
2 * Copyright (c) 2016 Ecole Polytechnique de Montreal, Ericsson
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 package org.eclipse.tracecompass.tmf.analysis.xml.core.model;
10
11 import java.util.Map.Entry;
12
13 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprovider.XmlPatternStateProvider;
14 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
15 import org.eclipse.tracecompass.tmf.analysis.xml.core.module.IXmlStateSystemContainer;
16 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
17
18 /**
19 * This action will reset the value of each stored values to a null
20 * {@link ITmfStateValue} in the state system
21 *
22 * @since 2.0
23 */
24 public class ResetStoredFieldsAction implements ITmfXmlAction {
25
26 private final IXmlStateSystemContainer fParent;
27
28 /**
29 * Constructor
30 *
31 * @param parent
32 * The state system container this action belongs to
33 */
34 public ResetStoredFieldsAction(IXmlStateSystemContainer parent) {
35 fParent = parent;
36 }
37
38 @Override
39 public void execute(ITmfEvent event, TmfXmlScenarioInfo scenarioInfo) {
40 if (fParent instanceof XmlPatternStateProvider) {
41 for (Entry<String, String> entry : ((XmlPatternStateProvider) fParent).getStoredFields().entrySet()) {
42 ((XmlPatternStateProvider) fParent).getHistoryBuilder().resetStoredFields(fParent, entry.getValue(), scenarioInfo, event);
43 }
44 }
45 }
46 }
This page took 0.035782 seconds and 6 git commands to generate.