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 / TmfXmlPatternSegmentBuilder.java
index 848cd6db9afef93ff58791a0e9af263af0fd1e8a..7b6c1771078672aa08b52ed026c90f664d43f2ad 100644 (file)
@@ -14,6 +14,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.Activator;
@@ -147,6 +148,31 @@ public class TmfXmlPatternSegmentBuilder {
         for (TmfXmlPatternSegmentField field : fFields) {
             fields.put(field.getName(), field.getValue(event, scenarioInfo));
         }
+        if (scenarioInfo != null) {
+            addStoredFieldsContent(event, fields, scenarioInfo);
+        }
+    }
+
+    /**
+     * Query the stored fields path and add them to the content of the pattern
+     * segment. This is specific to pattern analysis.
+     *
+     * @param event
+     *            The active event
+     * @param fields
+     *            The segment fields
+     * @param info
+     *            The active scenario details
+     */
+    protected void addStoredFieldsContent(ITmfEvent event, Map<String, ITmfStateValue> fields, final TmfXmlScenarioInfo info) {
+        if (fContainer instanceof XmlPatternStateProvider) {
+            for (Entry<String, String> entry : ((XmlPatternStateProvider) fContainer).getStoredFields().entrySet()) {
+                ITmfStateValue value = ((XmlPatternStateProvider) fContainer).getHistoryBuilder().getStoredFieldValue(fContainer, entry.getValue(), info, event);
+                if (!value.isNull()) {
+                    fields.put(entry.getValue(), value);
+                }
+            }
+        }
     }
 
     private static ITmfStateValue getStateValueFromConstant(String constantValue, String type) {
This page took 0.025098 seconds and 5 git commands to generate.