1 /*******************************************************************************
2 * Copyright (c) 2014 École Polytechnique de Montréal
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
10 * Geneviève Bastien - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.internal
.tmf
.analysis
.xml
.core
.model
.readonly
;
15 import java
.util
.List
;
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
.TmfXmlMapEntry
;
27 import org
.eclipse
.tracecompass
.internal
.tmf
.analysis
.xml
.core
.model
.TmfXmlLocation
;
28 import org
.eclipse
.tracecompass
.internal
.tmf
.analysis
.xml
.core
.model
.TmfXmlPatternEventHandler
;
29 import org
.eclipse
.tracecompass
.internal
.tmf
.analysis
.xml
.core
.model
.TmfXmlPatternSegmentBuilder
;
30 import org
.eclipse
.tracecompass
.internal
.tmf
.analysis
.xml
.core
.model
.TmfXmlState
;
31 import org
.eclipse
.tracecompass
.internal
.tmf
.analysis
.xml
.core
.model
.TmfXmlStateChange
;
32 import org
.eclipse
.tracecompass
.internal
.tmf
.analysis
.xml
.core
.model
.TmfXmlStateTransition
;
33 import org
.eclipse
.tracecompass
.internal
.tmf
.analysis
.xml
.core
.model
.TmfXmlTimestampCondition
;
34 import org
.eclipse
.tracecompass
.internal
.tmf
.analysis
.xml
.core
.model
.TmfXmlTransitionValidator
;
35 import org
.eclipse
.tracecompass
.internal
.tmf
.analysis
.xml
.core
.module
.IXmlStateSystemContainer
;
36 import org
.w3c
.dom
.Element
;
39 * Concrete factory for XML model elements in read only mode
41 * @author Geneviève Bastien
43 public class TmfXmlReadOnlyModelFactory
implements ITmfXmlModelFactory
{
45 private static @Nullable ITmfXmlModelFactory fInstance
= null;
48 * Get the instance of this model creator
50 * @return The {@link TmfXmlReadOnlyModelFactory} instance
52 public static synchronized ITmfXmlModelFactory
getInstance() {
53 ITmfXmlModelFactory instance
= fInstance
;
54 if (instance
== null) {
55 instance
= new TmfXmlReadOnlyModelFactory();
62 public ITmfXmlStateAttribute
createStateAttribute(Element attribute
, IXmlStateSystemContainer container
) {
63 return new TmfXmlReadOnlyStateAttribute(this, attribute
, container
);
67 public ITmfXmlStateValue
createStateValue(Element node
, IXmlStateSystemContainer container
, List
<ITmfXmlStateAttribute
> attributes
) {
68 return new TmfXmlReadOnlyStateValue(this, node
, container
, attributes
);
72 public ITmfXmlStateValue
createStateValue(Element node
, IXmlStateSystemContainer container
, String eventField
) {
73 return new TmfXmlReadOnlyStateValue(this, node
, container
, eventField
);
77 public TmfXmlCondition
createCondition(Element node
, IXmlStateSystemContainer container
) {
78 return TmfXmlCondition
.create(this, node
, container
);
82 public TmfXmlEventHandler
createEventHandler(Element node
, IXmlStateSystemContainer container
) {
83 return new TmfXmlEventHandler(this, node
, container
);
87 public TmfXmlStateChange
createStateChange(Element node
, IXmlStateSystemContainer container
) {
88 return new TmfXmlStateChange(this, node
, container
);
92 public TmfXmlLocation
createLocation(Element node
, IXmlStateSystemContainer container
) {
93 return new TmfXmlLocation(this, node
, container
);
97 public TmfXmlPatternEventHandler
createPatternEventHandler(Element node
, IXmlStateSystemContainer container
) {
98 return new TmfXmlPatternEventHandler(this, node
, container
);
102 public TmfXmlTransitionValidator
createTransitionValidator(Element node
, IXmlStateSystemContainer container
) {
103 return new TmfXmlTransitionValidator(this, node
, container
);
107 public TmfXmlAction
createAction(Element node
, IXmlStateSystemContainer container
) {
108 return new TmfXmlAction(this, node
, container
);
112 public TmfXmlFsm
createFsm(Element node
, IXmlStateSystemContainer container
) {
113 return TmfXmlFsm
.create(this, node
, container
);
117 public @NonNull TmfXmlState
createState(Element node
, IXmlStateSystemContainer container
, @Nullable TmfXmlState parent
) {
118 return TmfXmlState
.create(this, node
, container
, parent
);
122 public TmfXmlStateTransition
createStateTransition(Element node
, IXmlStateSystemContainer container
) {
123 return new TmfXmlStateTransition(this, node
, container
);
127 public TmfXmlTimestampCondition
createTimestampsCondition(Element node
, IXmlStateSystemContainer container
) {
128 return new TmfXmlTimestampCondition(this, node
, container
);
132 public TmfXmlPatternSegmentBuilder
createPatternSegmentBuilder(Element node
, IXmlStateSystemContainer container
) {
133 return new TmfXmlPatternSegmentBuilder(this, node
, container
);
137 public @NonNull TmfXmlMapEntry
createMapEntry(@NonNull Element node
, @NonNull IXmlStateSystemContainer container
) {
138 return new TmfXmlMapEntry(this, node
, container
);