| /******************************************************************************* |
| * Copyright (c) 2012 Bundesinstitut für Risikobewertung and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Bundesinstitut für Risikobewertung - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.stem.model.metamodel.impl; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EDataType; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.emf.ecore.EPackage; |
| import org.eclipse.emf.ecore.impl.EFactoryImpl; |
| import org.eclipse.emf.ecore.plugin.EcorePlugin; |
| import org.eclipse.emf.ecore.resource.Resource; |
| import org.eclipse.stem.model.metamodel.AuthorDetails; |
| import org.eclipse.stem.model.metamodel.Compartment; |
| import org.eclipse.stem.model.metamodel.CompartmentGroup; |
| import org.eclipse.stem.model.metamodel.CompartmentType; |
| import org.eclipse.stem.model.metamodel.MetamodelFactory; |
| import org.eclipse.stem.model.metamodel.MetamodelPackage; |
| import org.eclipse.stem.model.metamodel.Model; |
| import org.eclipse.stem.model.metamodel.ModelGenSettings; |
| import org.eclipse.stem.model.metamodel.ModelParam; |
| import org.eclipse.stem.model.metamodel.ModelParamConstraint; |
| import org.eclipse.stem.model.metamodel.ModelType; |
| import org.eclipse.stem.model.metamodel.PackageGenSettings; |
| import org.eclipse.stem.model.metamodel.Transition; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Factory</b>. |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class MetamodelFactoryImpl extends EFactoryImpl implements MetamodelFactory { |
| /** |
| * Creates the default factory implementation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static MetamodelFactory init() { |
| try { |
| MetamodelFactory theMetamodelFactory = (MetamodelFactory)EPackage.Registry.INSTANCE.getEFactory("http:///org/eclipse/stem/model/metamodel.ecore"); |
| if (theMetamodelFactory != null) { |
| return theMetamodelFactory; |
| } |
| } |
| catch (Exception exception) { |
| EcorePlugin.INSTANCE.log(exception); |
| } |
| return new MetamodelFactoryImpl(); |
| } |
| |
| /** |
| * Creates an instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MetamodelFactoryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EObject create(EClass eClass) { |
| switch (eClass.getClassifierID()) { |
| case MetamodelPackage.PACKAGE: return createPackage(); |
| case MetamodelPackage.MODEL: return createModel(); |
| case MetamodelPackage.MODEL_PARAM: return createModelParam(); |
| case MetamodelPackage.MODEL_PARAM_CONSTRAINT: return createModelParamConstraint(); |
| case MetamodelPackage.COMPARTMENT_GROUP: return createCompartmentGroup(); |
| case MetamodelPackage.COMPARTMENT: return createCompartment(); |
| case MetamodelPackage.AUTHOR_DETAILS: return createAuthorDetails(); |
| case MetamodelPackage.PACKAGE_GEN_SETTINGS: return createPackageGenSettings(); |
| case MetamodelPackage.MODEL_GEN_SETTINGS: return createModelGenSettings(); |
| case MetamodelPackage.TRANSITION: return createTransition(); |
| default: |
| throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object createFromString(EDataType eDataType, String initialValue) { |
| switch (eDataType.getClassifierID()) { |
| case MetamodelPackage.MODEL_TYPE: |
| return createModelTypeFromString(eDataType, initialValue); |
| case MetamodelPackage.COMPARTMENT_TYPE: |
| return createCompartmentTypeFromString(eDataType, initialValue); |
| case MetamodelPackage.RESOURCE: |
| return createResourceFromString(eDataType, initialValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String convertToString(EDataType eDataType, Object instanceValue) { |
| switch (eDataType.getClassifierID()) { |
| case MetamodelPackage.MODEL_TYPE: |
| return convertModelTypeToString(eDataType, instanceValue); |
| case MetamodelPackage.COMPARTMENT_TYPE: |
| return convertCompartmentTypeToString(eDataType, instanceValue); |
| case MetamodelPackage.RESOURCE: |
| return convertResourceToString(eDataType, instanceValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.stem.model.metamodel.Package createPackage() { |
| PackageImpl package_ = new PackageImpl(); |
| return package_; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Model createModel() { |
| ModelImpl model = new ModelImpl(); |
| return model; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ModelParam createModelParam() { |
| ModelParamImpl modelParam = new ModelParamImpl(); |
| return modelParam; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ModelParamConstraint createModelParamConstraint() { |
| ModelParamConstraintImpl modelParamConstraint = new ModelParamConstraintImpl(); |
| return modelParamConstraint; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CompartmentGroup createCompartmentGroup() { |
| CompartmentGroupImpl compartmentGroup = new CompartmentGroupImpl(); |
| return compartmentGroup; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Compartment createCompartment() { |
| CompartmentImpl compartment = new CompartmentImpl(); |
| return compartment; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public AuthorDetails createAuthorDetails() { |
| AuthorDetailsImpl authorDetails = new AuthorDetailsImpl(); |
| return authorDetails; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ModelGenSettings createModelGenSettings() { |
| ModelGenSettingsImpl modelGenSettings = new ModelGenSettingsImpl(); |
| return modelGenSettings; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Transition createTransition() { |
| TransitionImpl transition = new TransitionImpl(); |
| return transition; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public PackageGenSettings createPackageGenSettings() { |
| PackageGenSettingsImpl packageGenSettings = new PackageGenSettingsImpl(); |
| return packageGenSettings; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ModelType createModelTypeFromString(EDataType eDataType, String initialValue) { |
| ModelType result = ModelType.get(initialValue); |
| if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
| return result; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String convertModelTypeToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CompartmentType createCompartmentTypeFromString(EDataType eDataType, String initialValue) { |
| CompartmentType result = CompartmentType.get(initialValue); |
| if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
| return result; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String convertCompartmentTypeToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Resource createResourceFromString(EDataType eDataType, String initialValue) { |
| return (Resource)super.createFromString(eDataType, initialValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String convertResourceToString(EDataType eDataType, Object instanceValue) { |
| return super.convertToString(eDataType, instanceValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MetamodelPackage getMetamodelPackage() { |
| return (MetamodelPackage)getEPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @deprecated |
| * @generated |
| */ |
| @Deprecated |
| public static MetamodelPackage getPackage() { |
| return MetamodelPackage.eINSTANCE; |
| } |
| |
| } //MetamodelFactoryImpl |