1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.markov.impl; |
8 | |
9 | import de.uka.ipd.sdq.markov.*; |
10 | |
11 | import org.eclipse.emf.ecore.EClass; |
12 | import org.eclipse.emf.ecore.EDataType; |
13 | import org.eclipse.emf.ecore.EObject; |
14 | import org.eclipse.emf.ecore.EPackage; |
15 | |
16 | import org.eclipse.emf.ecore.impl.EFactoryImpl; |
17 | |
18 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
19 | |
20 | /** |
21 | * <!-- begin-user-doc --> |
22 | * An implementation of the model <b>Factory</b>. |
23 | * <!-- end-user-doc --> |
24 | * @generated |
25 | */ |
26 | public class MarkovFactoryImpl extends EFactoryImpl implements MarkovFactory { |
27 | /** |
28 | * Creates the default factory implementation. |
29 | * <!-- begin-user-doc --> |
30 | * <!-- end-user-doc --> |
31 | * @generated |
32 | */ |
33 | public static MarkovFactory init() { |
34 | try { |
35 | MarkovFactory theMarkovFactory = (MarkovFactory)EPackage.Registry.INSTANCE.getEFactory("http://sdq.ipd.uka.de/FiniteMakovChain/1.0"); |
36 | if (theMarkovFactory != null) { |
37 | return theMarkovFactory; |
38 | } |
39 | } |
40 | catch (Exception exception) { |
41 | EcorePlugin.INSTANCE.log(exception); |
42 | } |
43 | return new MarkovFactoryImpl(); |
44 | } |
45 | |
46 | /** |
47 | * Creates an instance of the factory. |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @generated |
51 | */ |
52 | public MarkovFactoryImpl() { |
53 | super(); |
54 | } |
55 | |
56 | /** |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @generated |
60 | */ |
61 | @Override |
62 | public EObject create(EClass eClass) { |
63 | switch (eClass.getClassifierID()) { |
64 | case MarkovPackage.STATE: return createState(); |
65 | case MarkovPackage.TRANSITION: return createTransition(); |
66 | case MarkovPackage.MARKOV_CHAIN: return createMarkovChain(); |
67 | case MarkovPackage.ENTITY: return createEntity(); |
68 | case MarkovPackage.LABEL: return createLabel(); |
69 | default: |
70 | throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); |
71 | } |
72 | } |
73 | |
74 | /** |
75 | * <!-- begin-user-doc --> |
76 | * <!-- end-user-doc --> |
77 | * @generated |
78 | */ |
79 | @Override |
80 | public Object createFromString(EDataType eDataType, String initialValue) { |
81 | switch (eDataType.getClassifierID()) { |
82 | case MarkovPackage.STATE_TYPE: |
83 | return createStateTypeFromString(eDataType, initialValue); |
84 | default: |
85 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
86 | } |
87 | } |
88 | |
89 | /** |
90 | * <!-- begin-user-doc --> |
91 | * <!-- end-user-doc --> |
92 | * @generated |
93 | */ |
94 | @Override |
95 | public String convertToString(EDataType eDataType, Object instanceValue) { |
96 | switch (eDataType.getClassifierID()) { |
97 | case MarkovPackage.STATE_TYPE: |
98 | return convertStateTypeToString(eDataType, instanceValue); |
99 | default: |
100 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
101 | } |
102 | } |
103 | |
104 | /** |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @generated |
108 | */ |
109 | public State createState() { |
110 | StateImpl state = new StateImpl(); |
111 | return state; |
112 | } |
113 | |
114 | /** |
115 | * <!-- begin-user-doc --> |
116 | * <!-- end-user-doc --> |
117 | * @generated |
118 | */ |
119 | public Transition createTransition() { |
120 | TransitionImpl transition = new TransitionImpl(); |
121 | return transition; |
122 | } |
123 | |
124 | /** |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @generated |
128 | */ |
129 | public MarkovChain createMarkovChain() { |
130 | MarkovChainImpl markovChain = new MarkovChainImpl(); |
131 | return markovChain; |
132 | } |
133 | |
134 | /** |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @generated |
138 | */ |
139 | public Entity createEntity() { |
140 | EntityImpl entity = new EntityImpl(); |
141 | return entity; |
142 | } |
143 | |
144 | /** |
145 | * <!-- begin-user-doc --> |
146 | * <!-- end-user-doc --> |
147 | * @generated |
148 | */ |
149 | public Label createLabel() { |
150 | LabelImpl label = new LabelImpl(); |
151 | return label; |
152 | } |
153 | |
154 | /** |
155 | * <!-- begin-user-doc --> |
156 | * <!-- end-user-doc --> |
157 | * @generated |
158 | */ |
159 | public StateType createStateTypeFromString(EDataType eDataType, String initialValue) { |
160 | StateType result = StateType.get(initialValue); |
161 | if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
162 | return result; |
163 | } |
164 | |
165 | /** |
166 | * <!-- begin-user-doc --> |
167 | * <!-- end-user-doc --> |
168 | * @generated |
169 | */ |
170 | public String convertStateTypeToString(EDataType eDataType, Object instanceValue) { |
171 | return instanceValue == null ? null : instanceValue.toString(); |
172 | } |
173 | |
174 | /** |
175 | * <!-- begin-user-doc --> |
176 | * <!-- end-user-doc --> |
177 | * @generated |
178 | */ |
179 | public MarkovPackage getMarkovPackage() { |
180 | return (MarkovPackage)getEPackage(); |
181 | } |
182 | |
183 | /** |
184 | * <!-- begin-user-doc --> |
185 | * <!-- end-user-doc --> |
186 | * @deprecated |
187 | * @generated |
188 | */ |
189 | @Deprecated |
190 | public static MarkovPackage getPackage() { |
191 | return MarkovPackage.eINSTANCE; |
192 | } |
193 | |
194 | } //MarkovFactoryImpl |