/** * Copyright (c) 2011 committers of YAKINDU 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: * committers of YAKINDU - initial API and implementation * */ package org.yakindu.sct.model.sgraph.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.yakindu.sct.model.sgraph.Choice; import org.yakindu.sct.model.sgraph.ChoiceKind; import org.yakindu.sct.model.sgraph.Entry; import org.yakindu.sct.model.sgraph.EntryKind; import org.yakindu.sct.model.sgraph.Exit; import org.yakindu.sct.model.sgraph.FinalState; import org.yakindu.sct.model.sgraph.ImportDeclaration; import org.yakindu.sct.model.sgraph.ReactionProperty; import org.yakindu.sct.model.sgraph.Region; import org.yakindu.sct.model.sgraph.SGraphFactory; import org.yakindu.sct.model.sgraph.SGraphPackage; import org.yakindu.sct.model.sgraph.Scope; import org.yakindu.sct.model.sgraph.State; import org.yakindu.sct.model.sgraph.Statechart; import org.yakindu.sct.model.sgraph.Synchronization; import org.yakindu.sct.model.sgraph.Transition; /** * <!-- begin-user-doc --> * An implementation of the model <b>Factory</b>. * <!-- end-user-doc --> * @generated */ public class SGraphFactoryImpl extends EFactoryImpl implements SGraphFactory { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String copyright = "Copyright (c) 2011 committers of YAKINDU and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\nContributors:\r\ncommitters of YAKINDU - initial API and implementation\r\n"; /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static SGraphFactory init() { try { SGraphFactory theSGraphFactory = (SGraphFactory)EPackage.Registry.INSTANCE.getEFactory(SGraphPackage.eNS_URI); if (theSGraphFactory != null) { return theSGraphFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new SGraphFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SGraphFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case SGraphPackage.REGION: return createRegion(); case SGraphPackage.TRANSITION: return createTransition(); case SGraphPackage.FINAL_STATE: return createFinalState(); case SGraphPackage.CHOICE: return createChoice(); case SGraphPackage.STATECHART: return createStatechart(); case SGraphPackage.ENTRY: return createEntry(); case SGraphPackage.EXIT: return createExit(); case SGraphPackage.REACTION_PROPERTY: return createReactionProperty(); case SGraphPackage.SCOPE: return createScope(); case SGraphPackage.SYNCHRONIZATION: return createSynchronization(); case SGraphPackage.STATE: return createState(); case SGraphPackage.IMPORT_DECLARATION: return createImportDeclaration(); 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 SGraphPackage.ENTRY_KIND: return createEntryKindFromString(eDataType, initialValue); case SGraphPackage.CHOICE_KIND: return createChoiceKindFromString(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 SGraphPackage.ENTRY_KIND: return convertEntryKindToString(eDataType, instanceValue); case SGraphPackage.CHOICE_KIND: return convertChoiceKindToString(eDataType, instanceValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Region createRegion() { RegionImpl region = new RegionImpl(); return region; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Transition createTransition() { TransitionImpl transition = new TransitionImpl(); return transition; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public FinalState createFinalState() { FinalStateImpl finalState = new FinalStateImpl(); return finalState; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Choice createChoice() { ChoiceImpl choice = new ChoiceImpl(); return choice; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Statechart createStatechart() { StatechartImpl statechart = new StatechartImpl(); return statechart; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Entry createEntry() { EntryImpl entry = new EntryImpl(); return entry; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Exit createExit() { ExitImpl exit = new ExitImpl(); return exit; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ReactionProperty createReactionProperty() { ReactionPropertyImpl reactionProperty = new ReactionPropertyImpl(); return reactionProperty; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Scope createScope() { ScopeImpl scope = new ScopeImpl(); return scope; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Synchronization createSynchronization() { SynchronizationImpl synchronization = new SynchronizationImpl(); return synchronization; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public State createState() { StateImpl state = new StateImpl(); return state; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ImportDeclaration createImportDeclaration() { ImportDeclarationImpl importDeclaration = new ImportDeclarationImpl(); return importDeclaration; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EntryKind createEntryKindFromString(EDataType eDataType, String initialValue) { EntryKind result = EntryKind.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 convertEntryKindToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ChoiceKind createChoiceKindFromString(EDataType eDataType, String initialValue) { ChoiceKind result = ChoiceKind.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 convertChoiceKindToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SGraphPackage getSGraphPackage() { return (SGraphPackage)getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static SGraphPackage getPackage() { return SGraphPackage.eINSTANCE; } } //SGraphFactoryImpl