| /** |
| * Copyright (c) 2019 CEA LIST. |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation |
| */ |
| package org.eclipse.papyrus.sysml16.requirementsextension.internal.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.papyrus.sysml16.requirementsextension.*; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Factory</b>. |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class RequirementsExtensionFactoryImpl extends EFactoryImpl implements RequirementsExtensionFactory { |
| /** |
| * Creates the default factory implementation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static RequirementsExtensionFactory init() { |
| try { |
| RequirementsExtensionFactory theRequirementsExtensionFactory = (RequirementsExtensionFactory)EPackage.Registry.INSTANCE.getEFactory(RequirementsExtensionPackage.eNS_URI); |
| if (theRequirementsExtensionFactory != null) { |
| return theRequirementsExtensionFactory; |
| } |
| } |
| catch (Exception exception) { |
| EcorePlugin.INSTANCE.log(exception); |
| } |
| return new RequirementsExtensionFactoryImpl(); |
| } |
| |
| /** |
| * Creates an instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public RequirementsExtensionFactoryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EObject create(EClass eClass) { |
| switch (eClass.getClassifierID()) { |
| case RequirementsExtensionPackage.FUNCTIONAL_REQUIREMENT: return createFunctionalRequirement(); |
| case RequirementsExtensionPackage.INTERFACE_REQUIREMENT: return createInterfaceRequirement(); |
| case RequirementsExtensionPackage.PERFORMANCE_REQUIREMENT: return createPerformanceRequirement(); |
| case RequirementsExtensionPackage.PHYSICAL_REQUIREMENT: return createPhysicalRequirement(); |
| case RequirementsExtensionPackage.DESIGN_CONSTRAINT: return createDesignConstraint(); |
| default: |
| throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object createFromString(EDataType eDataType, String initialValue) { |
| switch (eDataType.getClassifierID()) { |
| case RequirementsExtensionPackage.RISK_KIND: |
| return createRiskKindFromString(eDataType, initialValue); |
| case RequirementsExtensionPackage.VERIFICATION_METHOD_KIND: |
| return createVerificationMethodKindFromString(eDataType, initialValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String convertToString(EDataType eDataType, Object instanceValue) { |
| switch (eDataType.getClassifierID()) { |
| case RequirementsExtensionPackage.RISK_KIND: |
| return convertRiskKindToString(eDataType, instanceValue); |
| case RequirementsExtensionPackage.VERIFICATION_METHOD_KIND: |
| return convertVerificationMethodKindToString(eDataType, instanceValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public FunctionalRequirement createFunctionalRequirement() { |
| FunctionalRequirementImpl functionalRequirement = new FunctionalRequirementImpl(); |
| return functionalRequirement; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public InterfaceRequirement createInterfaceRequirement() { |
| InterfaceRequirementImpl interfaceRequirement = new InterfaceRequirementImpl(); |
| return interfaceRequirement; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public PerformanceRequirement createPerformanceRequirement() { |
| PerformanceRequirementImpl performanceRequirement = new PerformanceRequirementImpl(); |
| return performanceRequirement; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public PhysicalRequirement createPhysicalRequirement() { |
| PhysicalRequirementImpl physicalRequirement = new PhysicalRequirementImpl(); |
| return physicalRequirement; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public DesignConstraint createDesignConstraint() { |
| DesignConstraintImpl designConstraint = new DesignConstraintImpl(); |
| return designConstraint; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public RiskKind createRiskKindFromString(EDataType eDataType, String initialValue) { |
| RiskKind result = RiskKind.get(initialValue); |
| if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| return result; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String convertRiskKindToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public VerificationMethodKind createVerificationMethodKindFromString(EDataType eDataType, String initialValue) { |
| VerificationMethodKind result = VerificationMethodKind.get(initialValue); |
| if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| return result; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String convertVerificationMethodKindToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public RequirementsExtensionPackage getRequirementsExtensionPackage() { |
| return (RequirementsExtensionPackage)getEPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @deprecated |
| * @generated |
| */ |
| @Deprecated |
| public static RequirementsExtensionPackage getPackage() { |
| return RequirementsExtensionPackage.eINSTANCE; |
| } |
| |
| } //RequirementsExtensionFactoryImpl |