| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.pcm.designdecision.PrimitiveTypes.impl; |
| 8 | |
| 9 | import de.uka.ipd.sdq.pcm.designdecision.PrimitiveTypes.*; |
| 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 PrimitiveTypesFactoryImpl extends EFactoryImpl implements PrimitiveTypesFactory { |
| 27 | /** |
| 28 | * Creates the default factory implementation. |
| 29 | * <!-- begin-user-doc --> |
| 30 | * <!-- end-user-doc --> |
| 31 | * @generated |
| 32 | */ |
| 33 | public static PrimitiveTypesFactory init() { |
| 34 | try { |
| 35 | PrimitiveTypesFactory thePrimitiveTypesFactory = (PrimitiveTypesFactory)EPackage.Registry.INSTANCE.getEFactory("http:///DesignDecision/PrimitiveTypes.ecore"); |
| 36 | if (thePrimitiveTypesFactory != null) { |
| 37 | return thePrimitiveTypesFactory; |
| 38 | } |
| 39 | } |
| 40 | catch (Exception exception) { |
| 41 | EcorePlugin.INSTANCE.log(exception); |
| 42 | } |
| 43 | return new PrimitiveTypesFactoryImpl(); |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Creates an instance of the factory. |
| 48 | * <!-- begin-user-doc --> |
| 49 | * <!-- end-user-doc --> |
| 50 | * @generated |
| 51 | */ |
| 52 | public PrimitiveTypesFactoryImpl() { |
| 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 | default: |
| 65 | throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * <!-- begin-user-doc --> |
| 71 | * <!-- end-user-doc --> |
| 72 | * @generated |
| 73 | */ |
| 74 | @Override |
| 75 | public Object createFromString(EDataType eDataType, String initialValue) { |
| 76 | switch (eDataType.getClassifierID()) { |
| 77 | case PrimitiveTypesPackage.DOUBLE: |
| 78 | return createdoubleFromString(eDataType, initialValue); |
| 79 | default: |
| 80 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * <!-- begin-user-doc --> |
| 86 | * <!-- end-user-doc --> |
| 87 | * @generated |
| 88 | */ |
| 89 | @Override |
| 90 | public String convertToString(EDataType eDataType, Object instanceValue) { |
| 91 | switch (eDataType.getClassifierID()) { |
| 92 | case PrimitiveTypesPackage.DOUBLE: |
| 93 | return convertdoubleToString(eDataType, instanceValue); |
| 94 | default: |
| 95 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * <!-- begin-user-doc --> |
| 101 | * <!-- end-user-doc --> |
| 102 | * @generated |
| 103 | */ |
| 104 | public Double createdoubleFromString(EDataType eDataType, String initialValue) { |
| 105 | return (Double)super.createFromString(eDataType, initialValue); |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * <!-- begin-user-doc --> |
| 110 | * <!-- end-user-doc --> |
| 111 | * @generated |
| 112 | */ |
| 113 | public String convertdoubleToString(EDataType eDataType, Object instanceValue) { |
| 114 | return super.convertToString(eDataType, instanceValue); |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * <!-- begin-user-doc --> |
| 119 | * <!-- end-user-doc --> |
| 120 | * @generated |
| 121 | */ |
| 122 | public PrimitiveTypesPackage getPrimitiveTypesPackage() { |
| 123 | return (PrimitiveTypesPackage)getEPackage(); |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * <!-- begin-user-doc --> |
| 128 | * <!-- end-user-doc --> |
| 129 | * @deprecated |
| 130 | * @generated |
| 131 | */ |
| 132 | @Deprecated |
| 133 | public static PrimitiveTypesPackage getPackage() { |
| 134 | return PrimitiveTypesPackage.eINSTANCE; |
| 135 | } |
| 136 | |
| 137 | } //PrimitiveTypesFactoryImpl |