b1859e9ff765833add98ee4f90f76732f721c976
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.analysis.xml.core / src / org / eclipse / tracecompass / internal / tmf / analysis / xml / core / model / readwrite / TmfXmlReadWriteModelFactory.java
1 /*******************************************************************************
2 * Copyright (c) 2014 É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.tracecompass.internal.tmf.analysis.xml.core.model.readwrite;
14
15 import java.util.List;
16
17 import org.eclipse.jdt.annotation.NonNull;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.ITmfXmlModelFactory;
20 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.ITmfXmlStateAttribute;
21 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.ITmfXmlStateValue;
22 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.TmfXmlAction;
23 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.TmfXmlCondition;
24 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.TmfXmlEventHandler;
25 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.TmfXmlFsm;
26 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.TmfXmlLocation;
27 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.TmfXmlPatternEventHandler;
28 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.TmfXmlPatternSegmentBuilder;
29 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.TmfXmlState;
30 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.TmfXmlStateChange;
31 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.TmfXmlStateTransition;
32 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.TmfXmlTimestampCondition;
33 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.model.TmfXmlTransitionValidator;
34 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.module.IXmlStateSystemContainer;
35 import org.w3c.dom.Element;
36
37 /**
38 * Concrete factory for XML model elements in read write mode
39 *
40 * @author Geneviève Bastien
41 */
42 public class TmfXmlReadWriteModelFactory implements ITmfXmlModelFactory {
43
44 private static @Nullable ITmfXmlModelFactory fInstance = null;
45
46 /**
47 * Get the instance of this model creator
48 *
49 * @return The {@link TmfXmlReadWriteModelFactory} instance
50 */
51 public static synchronized ITmfXmlModelFactory getInstance() {
52 ITmfXmlModelFactory instance = fInstance;
53 if (instance == null) {
54 instance = new TmfXmlReadWriteModelFactory();
55 fInstance = instance;
56 }
57 return instance;
58 }
59
60 @Override
61 public ITmfXmlStateAttribute createStateAttribute(Element attribute, IXmlStateSystemContainer container) {
62 return new TmfXmlReadWriteStateAttribute(this, attribute, container);
63 }
64
65 @Override
66 public ITmfXmlStateValue createStateValue(Element node, IXmlStateSystemContainer container, List<ITmfXmlStateAttribute> attributes) {
67 return new TmfXmlReadWriteStateValue(this, node, container, attributes);
68 }
69
70 @Override
71 public ITmfXmlStateValue createStateValue(Element node, IXmlStateSystemContainer container, String eventField) {
72 return new TmfXmlReadWriteStateValue(this, node, container, eventField);
73 }
74
75 @Override
76 public TmfXmlCondition createCondition(Element node, IXmlStateSystemContainer container) {
77 return TmfXmlCondition.create(this, node, container);
78 }
79
80 @Override
81 public TmfXmlEventHandler createEventHandler(Element node, IXmlStateSystemContainer container) {
82 return new TmfXmlEventHandler(this, node, container);
83 }
84
85 @Override
86 public TmfXmlStateChange createStateChange(Element node, IXmlStateSystemContainer container) {
87 return new TmfXmlStateChange(this, node, container);
88 }
89
90 @Override
91 public TmfXmlLocation createLocation(Element node, IXmlStateSystemContainer container) {
92 return new TmfXmlLocation(this, node, container);
93 }
94
95 @Override
96 public TmfXmlPatternEventHandler createPatternEventHandler(Element node, IXmlStateSystemContainer container) {
97 return new TmfXmlPatternEventHandler(this, node, container);
98 }
99
100 @Override
101 public TmfXmlTransitionValidator createTransitionValidator(Element node, IXmlStateSystemContainer container) {
102 return new TmfXmlTransitionValidator(this, node, container);
103 }
104
105 @Override
106 public TmfXmlAction createAction(Element node, IXmlStateSystemContainer container) {
107 return new TmfXmlAction(this, node, container);
108 }
109
110 @Override
111 public TmfXmlFsm createFsm(Element node, IXmlStateSystemContainer container) {
112 return TmfXmlFsm.create(this, node, container);
113 }
114
115 @Override
116 public @NonNull TmfXmlState createState(Element node, IXmlStateSystemContainer container, @Nullable TmfXmlState parent) {
117 return TmfXmlState.create(this, node, container, parent);
118 }
119
120 @Override
121 public TmfXmlStateTransition createStateTransition(Element node, IXmlStateSystemContainer container) {
122 return new TmfXmlStateTransition(this, node, container);
123 }
124
125 @Override
126 public TmfXmlTimestampCondition createTimestampsCondition(Element node, IXmlStateSystemContainer container) {
127 return new TmfXmlTimestampCondition(this, node, container);
128 }
129
130 @Override
131 public TmfXmlPatternSegmentBuilder createPatternSegmentBuilder(Element node, IXmlStateSystemContainer container) {
132 return new TmfXmlPatternSegmentBuilder(this, node, container);
133 }
134 }
This page took 0.038937 seconds and 4 git commands to generate.