| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package edu.kit.ipd.sdq.completionfeaturemodel.impl; |
| 8 | |
| 9 | import edu.kit.ipd.sdq.completionfeaturemodel.*; |
| 10 | import org.eclipse.emf.ecore.EClass; |
| 11 | import org.eclipse.emf.ecore.EDataType; |
| 12 | import org.eclipse.emf.ecore.EObject; |
| 13 | import org.eclipse.emf.ecore.EPackage; |
| 14 | import org.eclipse.emf.ecore.impl.EFactoryImpl; |
| 15 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
| 16 | |
| 17 | import edu.kit.ipd.sdq.completionfeaturemodel.CompletionFeature; |
| 18 | import edu.kit.ipd.sdq.completionfeaturemodel.CompletionFeatureDiagram; |
| 19 | import edu.kit.ipd.sdq.completionfeaturemodel.CompletionFeatureGroup; |
| 20 | import edu.kit.ipd.sdq.completionfeaturemodel.CompletionSimple; |
| 21 | import edu.kit.ipd.sdq.completionfeaturemodel.DisambiguationRule; |
| 22 | import edu.kit.ipd.sdq.completionfeaturemodel.FeatureState; |
| 23 | import edu.kit.ipd.sdq.completionfeaturemodel.completionfeaturemodelFactory; |
| 24 | import edu.kit.ipd.sdq.completionfeaturemodel.completionfeaturemodelPackage; |
| 25 | |
| 26 | /** |
| 27 | * <!-- begin-user-doc --> |
| 28 | * An implementation of the model <b>Factory</b>. |
| 29 | * <!-- end-user-doc --> |
| 30 | * @generated |
| 31 | */ |
| 32 | public class completionfeaturemodelFactoryImpl extends EFactoryImpl implements completionfeaturemodelFactory { |
| 33 | /** |
| 34 | * Creates the default factory implementation. |
| 35 | * <!-- begin-user-doc --> |
| 36 | * <!-- end-user-doc --> |
| 37 | * @generated |
| 38 | */ |
| 39 | public static completionfeaturemodelFactory init() { |
| 40 | try { |
| 41 | completionfeaturemodelFactory thecompletionfeaturemodelFactory = (completionfeaturemodelFactory)EPackage.Registry.INSTANCE.getEFactory("http://sdq.ipd.kit.edu/CompletionFeatureModel/1.0"); |
| 42 | if (thecompletionfeaturemodelFactory != null) { |
| 43 | return thecompletionfeaturemodelFactory; |
| 44 | } |
| 45 | } |
| 46 | catch (Exception exception) { |
| 47 | EcorePlugin.INSTANCE.log(exception); |
| 48 | } |
| 49 | return new completionfeaturemodelFactoryImpl(); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Creates an instance of the factory. |
| 54 | * <!-- begin-user-doc --> |
| 55 | * <!-- end-user-doc --> |
| 56 | * @generated |
| 57 | */ |
| 58 | public completionfeaturemodelFactoryImpl() { |
| 59 | super(); |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * <!-- begin-user-doc --> |
| 64 | * <!-- end-user-doc --> |
| 65 | * @generated |
| 66 | */ |
| 67 | @Override |
| 68 | public EObject create(EClass eClass) { |
| 69 | switch (eClass.getClassifierID()) { |
| 70 | case completionfeaturemodelPackage.COMPLETION_FEATURE: return createCompletionFeature(); |
| 71 | case completionfeaturemodelPackage.DISAMBIGUATION_RULE: return createDisambiguationRule(); |
| 72 | case completionfeaturemodelPackage.COMPLETION_FEATURE_DIAGRAM: return createCompletionFeatureDiagram(); |
| 73 | case completionfeaturemodelPackage.COMPLETION_SIMPLE: return createCompletionSimple(); |
| 74 | case completionfeaturemodelPackage.COMPLETION_FEATURE_GROUP: return createCompletionFeatureGroup(); |
| 75 | default: |
| 76 | throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * <!-- begin-user-doc --> |
| 82 | * <!-- end-user-doc --> |
| 83 | * @generated |
| 84 | */ |
| 85 | @Override |
| 86 | public Object createFromString(EDataType eDataType, String initialValue) { |
| 87 | switch (eDataType.getClassifierID()) { |
| 88 | case completionfeaturemodelPackage.FEATURE_STATE: |
| 89 | return createFeatureStateFromString(eDataType, initialValue); |
| 90 | default: |
| 91 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * <!-- begin-user-doc --> |
| 97 | * <!-- end-user-doc --> |
| 98 | * @generated |
| 99 | */ |
| 100 | @Override |
| 101 | public String convertToString(EDataType eDataType, Object instanceValue) { |
| 102 | switch (eDataType.getClassifierID()) { |
| 103 | case completionfeaturemodelPackage.FEATURE_STATE: |
| 104 | return convertFeatureStateToString(eDataType, instanceValue); |
| 105 | default: |
| 106 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * <!-- begin-user-doc --> |
| 112 | * <!-- end-user-doc --> |
| 113 | * @generated |
| 114 | */ |
| 115 | public CompletionFeature createCompletionFeature() { |
| 116 | CompletionFeatureImpl completionFeature = new CompletionFeatureImpl(); |
| 117 | return completionFeature; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * <!-- begin-user-doc --> |
| 122 | * <!-- end-user-doc --> |
| 123 | * @generated |
| 124 | */ |
| 125 | public DisambiguationRule createDisambiguationRule() { |
| 126 | DisambiguationRuleImpl disambiguationRule = new DisambiguationRuleImpl(); |
| 127 | return disambiguationRule; |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * <!-- begin-user-doc --> |
| 132 | * <!-- end-user-doc --> |
| 133 | * @generated |
| 134 | */ |
| 135 | public CompletionFeatureDiagram createCompletionFeatureDiagram() { |
| 136 | CompletionFeatureDiagramImpl completionFeatureDiagram = new CompletionFeatureDiagramImpl(); |
| 137 | return completionFeatureDiagram; |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * <!-- begin-user-doc --> |
| 142 | * <!-- end-user-doc --> |
| 143 | * @generated |
| 144 | */ |
| 145 | public CompletionSimple createCompletionSimple() { |
| 146 | CompletionSimpleImpl completionSimple = new CompletionSimpleImpl(); |
| 147 | return completionSimple; |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * <!-- begin-user-doc --> |
| 152 | * <!-- end-user-doc --> |
| 153 | * @generated |
| 154 | */ |
| 155 | public CompletionFeatureGroup createCompletionFeatureGroup() { |
| 156 | CompletionFeatureGroupImpl completionFeatureGroup = new CompletionFeatureGroupImpl(); |
| 157 | return completionFeatureGroup; |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * <!-- begin-user-doc --> |
| 162 | * <!-- end-user-doc --> |
| 163 | * @generated |
| 164 | */ |
| 165 | public FeatureState createFeatureStateFromString(EDataType eDataType, String initialValue) { |
| 166 | FeatureState result = FeatureState.get(initialValue); |
| 167 | if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
| 168 | return result; |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * <!-- begin-user-doc --> |
| 173 | * <!-- end-user-doc --> |
| 174 | * @generated |
| 175 | */ |
| 176 | public String convertFeatureStateToString(EDataType eDataType, Object instanceValue) { |
| 177 | return instanceValue == null ? null : instanceValue.toString(); |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * <!-- begin-user-doc --> |
| 182 | * <!-- end-user-doc --> |
| 183 | * @generated |
| 184 | */ |
| 185 | public completionfeaturemodelPackage getcompletionfeaturemodelPackage() { |
| 186 | return (completionfeaturemodelPackage)getEPackage(); |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * <!-- begin-user-doc --> |
| 191 | * <!-- end-user-doc --> |
| 192 | * @deprecated |
| 193 | * @generated |
| 194 | */ |
| 195 | @Deprecated |
| 196 | public static completionfeaturemodelPackage getPackage() { |
| 197 | return completionfeaturemodelPackage.eINSTANCE; |
| 198 | } |
| 199 | |
| 200 | } //completionfeaturemodelFactoryImpl |