| /** |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * 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 |
| * |
| * Based on ideas from Xtext, Xtend, Xcore |
| * |
| * Contributors: |
| * Joerg Riegel - Initial implementation |
| * |
| */ |
| package org.eclipse.osbp.xtext.topologydsl.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.osbp.xtext.topologydsl.*; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Factory</b>. |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class TopologyDSLFactoryImpl extends EFactoryImpl implements TopologyDSLFactory { |
| /** |
| * Creates the default factory implementation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static TopologyDSLFactory init() { |
| try { |
| TopologyDSLFactory theTopologyDSLFactory = (TopologyDSLFactory)EPackage.Registry.INSTANCE.getEFactory(TopologyDSLPackage.eNS_URI); |
| if (theTopologyDSLFactory != null) { |
| return theTopologyDSLFactory; |
| } |
| } |
| catch (Exception exception) { |
| EcorePlugin.INSTANCE.log(exception); |
| } |
| return new TopologyDSLFactoryImpl(); |
| } |
| |
| /** |
| * Creates an instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public TopologyDSLFactoryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EObject create(EClass eClass) { |
| switch (eClass.getClassifierID()) { |
| case TopologyDSLPackage.TOPOLOGY_MODEL: return createTopologyModel(); |
| case TopologyDSLPackage.TOPOLOGY_BASE: return createTopologyBase(); |
| case TopologyDSLPackage.TOPOLOGY_PACKAGE: return createTopologyPackage(); |
| case TopologyDSLPackage.TOPOLOGY: return createTopology(); |
| 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 TopologyDSLPackage.TOPOLOGY_PROPERTY: |
| return createTopologyPropertyFromString(eDataType, initialValue); |
| case TopologyDSLPackage.TOPOLOGY_PROJECTION: |
| return createTopologyProjectionFromString(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 TopologyDSLPackage.TOPOLOGY_PROPERTY: |
| return convertTopologyPropertyToString(eDataType, instanceValue); |
| case TopologyDSLPackage.TOPOLOGY_PROJECTION: |
| return convertTopologyProjectionToString(eDataType, instanceValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public TopologyModel createTopologyModel() { |
| TopologyModelImpl topologyModel = new TopologyModelImpl(); |
| return topologyModel; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public TopologyBase createTopologyBase() { |
| TopologyBaseImpl topologyBase = new TopologyBaseImpl(); |
| return topologyBase; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public TopologyPackage createTopologyPackage() { |
| TopologyPackageImpl topologyPackage = new TopologyPackageImpl(); |
| return topologyPackage; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Topology createTopology() { |
| TopologyImpl topology = new TopologyImpl(); |
| return topology; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public TopologyProperty createTopologyPropertyFromString(EDataType eDataType, String initialValue) { |
| TopologyProperty result = TopologyProperty.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 convertTopologyPropertyToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public TopologyProjection createTopologyProjectionFromString(EDataType eDataType, String initialValue) { |
| TopologyProjection result = TopologyProjection.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 convertTopologyProjectionToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public TopologyDSLPackage getTopologyDSLPackage() { |
| return (TopologyDSLPackage)getEPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @deprecated |
| * @generated |
| */ |
| @Deprecated |
| public static TopologyDSLPackage getPackage() { |
| return TopologyDSLPackage.eINSTANCE; |
| } |
| |
| } //TopologyDSLFactoryImpl |