00001 00007 package org.best_of_robotics.model.datatypes.impl; 00008 00009 import org.best_of_robotics.model.datatypes.*; 00010 import org.best_of_robotics.model.datatypes.Bool; 00011 import org.best_of_robotics.model.datatypes.Char; 00012 import org.best_of_robotics.model.datatypes.CustomType; 00013 import org.best_of_robotics.model.datatypes.DatatypesFactory; 00014 import org.best_of_robotics.model.datatypes.DatatypesPackage; 00015 import org.best_of_robotics.model.datatypes.Field; 00016 import org.best_of_robotics.model.datatypes.Int; 00017 import org.best_of_robotics.model.datatypes.RosIDLReference; 00018 import org.best_of_robotics.model.datatypes.TypesLibrary; 00019 import org.best_of_robotics.model.datatypes.UnsignedChar; 00020 import org.best_of_robotics.model.datatypes.UnsignedInt; 00021 import org.best_of_robotics.model.datatypes.UnsignedLong; 00022 import org.best_of_robotics.model.datatypes.UnsignedShort; 00023 import org.best_of_robotics.model.datatypes.VectorType; 00024 import org.eclipse.emf.ecore.EClass; 00025 import org.eclipse.emf.ecore.EObject; 00026 import org.eclipse.emf.ecore.EPackage; 00027 import org.eclipse.emf.ecore.impl.EFactoryImpl; 00028 import org.eclipse.emf.ecore.plugin.EcorePlugin; 00029 00036 public class DatatypesFactoryImpl extends EFactoryImpl implements DatatypesFactory { 00043 public static DatatypesFactory init() { 00044 try { 00045 DatatypesFactory theDatatypesFactory = (DatatypesFactory)EPackage.Registry.INSTANCE.getEFactory("http://datatypes/1.0"); 00046 if (theDatatypesFactory != null) { 00047 return theDatatypesFactory; 00048 } 00049 } 00050 catch (Exception exception) { 00051 EcorePlugin.INSTANCE.log(exception); 00052 } 00053 return new DatatypesFactoryImpl(); 00054 } 00055 00062 public DatatypesFactoryImpl() { 00063 super(); 00064 } 00065 00071 @Override 00072 public EObject create(EClass eClass) { 00073 switch (eClass.getClassifierID()) { 00074 case DatatypesPackage.TYPES_LIBRARY: return createTypesLibrary(); 00075 case DatatypesPackage.SIMPLE_TYPE: return createSimpleType(); 00076 case DatatypesPackage.ROS_IDL_REFERENCE: return createRosIDLReference(); 00077 case DatatypesPackage.VECTOR_TYPE: return createVectorType(); 00078 case DatatypesPackage.CUSTOM_TYPE: return createCustomType(); 00079 case DatatypesPackage.FIELD: return createField(); 00080 default: 00081 throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); 00082 } 00083 } 00084 00090 public TypesLibrary createTypesLibrary() { 00091 TypesLibraryImpl typesLibrary = new TypesLibraryImpl(); 00092 return typesLibrary; 00093 } 00094 00100 public SimpleType createSimpleType() { 00101 SimpleTypeImpl simpleType = new SimpleTypeImpl(); 00102 return simpleType; 00103 } 00104 00110 public RosIDLReference createRosIDLReference() { 00111 RosIDLReferenceImpl rosIDLReference = new RosIDLReferenceImpl(); 00112 return rosIDLReference; 00113 } 00114 00120 public VectorType createVectorType() { 00121 VectorTypeImpl vectorType = new VectorTypeImpl(); 00122 return vectorType; 00123 } 00124 00130 public CustomType createCustomType() { 00131 CustomTypeImpl customType = new CustomTypeImpl(); 00132 return customType; 00133 } 00134 00140 public Field createField() { 00141 FieldImpl field = new FieldImpl(); 00142 return field; 00143 } 00144 00150 public DatatypesPackage getDatatypesPackage() { 00151 return (DatatypesPackage)getEPackage(); 00152 } 00153 00160 @Deprecated 00161 public static DatatypesPackage getPackage() { 00162 return DatatypesPackage.eINSTANCE; 00163 } 00164 00165 } //DatatypesFactoryImpl