Search in sources :

Example 1 with IBaseQuarkProvider

use of org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.model.IBaseQuarkProvider in project tracecompass by tracecompass.

the class TmfXmlStateSystemPathCu method compile.

/**
 * Compile a state system path from a list of XML elements
 *
 * @param analysisData
 *            The analysis data already compiled
 * @param elements
 *            The state attribute XML elements to compile
 * @return The state system path compilation unit or <code>null</code> if
 *         there was a compilation error
 */
@Nullable
public static TmfXmlStateSystemPathCu compile(AnalysisCompilationData analysisData, List<Element> elements) {
    IBaseQuarkProvider quarkProvider = IBaseQuarkProvider.IDENTITY_BASE_QUARK;
    List<TmfXmlStateValueCu> subAttribs = new ArrayList<>();
    for (Element subAttributeNode : elements) {
        List<TmfXmlStateValueCu> subAttrib = TmfXmlStateValueCu.compileAttribute(analysisData, subAttributeNode);
        if (subAttrib == null) {
            return null;
        }
        // by a scenario quark provider
        if (subAttrib.size() == 1) {
            if (subAttrib.get(0) == TmfXmlStateValueCu.CURRENT_SCENARIO_QUARK) {
                quarkProvider = IBaseQuarkProvider.CURRENT_SCENARIO_BASE_QUARK;
                continue;
            }
        }
        subAttribs.addAll(subAttrib);
    }
    return new TmfXmlStateSystemPathCu(subAttribs, quarkProvider);
}
Also used : Element(org.w3c.dom.Element) IBaseQuarkProvider(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.model.IBaseQuarkProvider) ArrayList(java.util.ArrayList) Nullable(org.eclipse.jdt.annotation.Nullable)

Aggregations

ArrayList (java.util.ArrayList)1 Nullable (org.eclipse.jdt.annotation.Nullable)1 IBaseQuarkProvider (org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.model.IBaseQuarkProvider)1 Element (org.w3c.dom.Element)1