| /******************************************************************************* |
| * Copyright (c) 2016 ALL4TEC & 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: |
| * ALL4TEC & CEA LIST - initial API and implementation |
| ******************************************************************************/ |
| package org.polarsys.esf.esfarchitectureconcepts.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.polarsys.esf.esfarchitectureconcepts.*; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Factory</b>. |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public class ESFArchitectureConceptsFactory |
| extends EFactoryImpl |
| implements IESFArchitectureConceptsFactory { |
| |
| /** |
| * Creates the default factory implementation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public static IESFArchitectureConceptsFactory init() { |
| try { |
| IESFArchitectureConceptsFactory theESFArchitectureConceptsFactory = |
| (IESFArchitectureConceptsFactory) EPackage.Registry.INSTANCE |
| .getEFactory(IESFArchitectureConceptsPackage.eNS_URI); |
| if (theESFArchitectureConceptsFactory != null) { |
| return theESFArchitectureConceptsFactory; |
| } |
| } catch (Exception exception) { |
| EcorePlugin.INSTANCE.log(exception); |
| } |
| return new ESFArchitectureConceptsFactory(); |
| } |
| |
| /** |
| * Creates an instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public ESFArchitectureConceptsFactory() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EObject create(EClass eClass) { |
| switch (eClass.getClassifierID()) { |
| case IESFArchitectureConceptsPackage.SPORT: |
| return createSPort(); |
| case IESFArchitectureConceptsPackage.SCONNECTOR: |
| return createSConnector(); |
| case IESFArchitectureConceptsPackage.SBLOCK: |
| return createSBlock(); |
| case IESFArchitectureConceptsPackage.SPART: |
| return createSPart(); |
| case IESFArchitectureConceptsPackage.SPORT_ROLE: |
| return createSPortRole(); |
| case IESFArchitectureConceptsPackage.SMODEL: |
| return createSModel(); |
| 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 IESFArchitectureConceptsPackage.SDIRECTION: |
| return createSDirectionFromString(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 IESFArchitectureConceptsPackage.SDIRECTION: |
| return convertSDirectionToString(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 |
| */ |
| public ISPort createSPort() { |
| SPort sPort = new SPort(); |
| return sPort; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public ISConnector createSConnector() { |
| SConnector sConnector = new SConnector(); |
| return sConnector; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public ISBlock createSBlock() { |
| SBlock sBlock = new SBlock(); |
| return sBlock; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public ISPart createSPart() { |
| SPart sPart = new SPart(); |
| return sPart; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public ISPortRole createSPortRole() { |
| SPortRole sPortRole = new SPortRole(); |
| return sPortRole; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public ISModel createSModel() { |
| SModel sModel = new SModel(); |
| return sModel; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public SDirection createSDirectionFromString(EDataType eDataType, String initialValue) { |
| SDirection result = SDirection.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 convertSDirectionToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public IESFArchitectureConceptsPackage getESFArchitectureConceptsPackage() { |
| return (IESFArchitectureConceptsPackage) getEPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @deprecated |
| * @generated |
| */ |
| @Deprecated |
| public static IESFArchitectureConceptsPackage getPackage() { |
| return IESFArchitectureConceptsPackage.eINSTANCE; |
| } |
| |
| } // ESFArchitectureConceptsFactory |