/** | |
* Copyright (c) 2020 CEA LIST. | |
* | |
* 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\n\nContributors: | |
* Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr | |
* - Initial API and Implementation | |
*/ | |
package org.eclipse.efm.ecore.formalml.statemachine.impl; | |
import org.eclipse.efm.ecore.formalml.statemachine.*; | |
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; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model <b>Factory</b>. | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public class StatemachineFactoryImpl extends EFactoryImpl implements StatemachineFactory { | |
/** | |
* Creates the default factory implementation. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public static StatemachineFactory init() { | |
try { | |
StatemachineFactory theStatemachineFactory = (StatemachineFactory)EPackage.Registry.INSTANCE.getEFactory(StatemachinePackage.eNS_URI); | |
if (theStatemachineFactory != null) { | |
return theStatemachineFactory; | |
} | |
} | |
catch (Exception exception) { | |
EcorePlugin.INSTANCE.log(exception); | |
} | |
return new StatemachineFactoryImpl(); | |
} | |
/** | |
* Creates an instance of the factory. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public StatemachineFactoryImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public EObject create(EClass eClass) { | |
switch (eClass.getClassifierID()) { | |
case StatemachinePackage.STATEMACHINE: return createStatemachine(); | |
case StatemachinePackage.REGION: return createRegion(); | |
case StatemachinePackage.VERTEX: return createVertex(); | |
case StatemachinePackage.PSEUDOSTATE: return createPseudostate(); | |
case StatemachinePackage.STATE: return createState(); | |
case StatemachinePackage.FINAL_STATE: return createFinalState(); | |
case StatemachinePackage.START_STATE: return createStartState(); | |
case StatemachinePackage.TRANSITION: return createTransition(); | |
case StatemachinePackage.TRANSITION_MOE: return createTransitionMoe(); | |
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 StatemachinePackage.PSEUDOSTATE_KIND: | |
return createPseudostateKindFromString(eDataType, initialValue); | |
case StatemachinePackage.TRANSITION_MOC: | |
return createTransitionMocFromString(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 StatemachinePackage.PSEUDOSTATE_KIND: | |
return convertPseudostateKindToString(eDataType, instanceValue); | |
case StatemachinePackage.TRANSITION_MOC: | |
return convertTransitionMocToString(eDataType, instanceValue); | |
default: | |
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); | |
} | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Statemachine createStatemachine() { | |
StatemachineImpl statemachine = new StatemachineImpl(); | |
return statemachine; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Region createRegion() { | |
RegionImpl region = new RegionImpl(); | |
return region; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Vertex createVertex() { | |
VertexImpl vertex = new VertexImpl(); | |
return vertex; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Pseudostate createPseudostate() { | |
PseudostateImpl pseudostate = new PseudostateImpl(); | |
return pseudostate; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public State createState() { | |
StateImpl state = new StateImpl(); | |
return state; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public FinalState createFinalState() { | |
FinalStateImpl finalState = new FinalStateImpl(); | |
return finalState; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public StartState createStartState() { | |
StartStateImpl startState = new StartStateImpl(); | |
return startState; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Transition createTransition() { | |
TransitionImpl transition = new TransitionImpl(); | |
return transition; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public TransitionMoe createTransitionMoe() { | |
TransitionMoeImpl transitionMoe = new TransitionMoeImpl(); | |
return transitionMoe; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public PseudostateKind createPseudostateKindFromString(EDataType eDataType, String initialValue) { | |
PseudostateKind result = PseudostateKind.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 convertPseudostateKindToString(EDataType eDataType, Object instanceValue) { | |
return instanceValue == null ? null : instanceValue.toString(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public TransitionMoc createTransitionMocFromString(EDataType eDataType, String initialValue) { | |
TransitionMoc result = TransitionMoc.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 convertTransitionMocToString(EDataType eDataType, Object instanceValue) { | |
return instanceValue == null ? null : instanceValue.toString(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public StatemachinePackage getStatemachinePackage() { | |
return (StatemachinePackage)getEPackage(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @deprecated | |
* @generated | |
*/ | |
@Deprecated | |
public static StatemachinePackage getPackage() { | |
return StatemachinePackage.eINSTANCE; | |
} | |
} //StatemachineFactoryImpl |