/** * Copyright (c) 2012-2016 Marsha Chechik, Alessio Di Sandro, Michalis Famelis, * Rick Salay. * 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: * Alessio Di Sandro - Implementation. */ package edu.toronto.cs.se.mavo.impl; import edu.toronto.cs.se.mavo.*; 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 MAVOFactoryImpl extends EFactoryImpl implements MAVOFactory { /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static MAVOFactory init() { try { MAVOFactory theMAVOFactory = (MAVOFactory)EPackage.Registry.INSTANCE.getEFactory(MAVOPackage.eNS_URI); if (theMAVOFactory != null) { return theMAVOFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new MAVOFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MAVOFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case MAVOPackage.MAVO_COLLECTION: return createMAVOCollection(); case MAVOPackage.MAY_DECISION: return createMayDecision(); case MAVOPackage.VAR_DECISION: return createVarDecision(); case MAVOPackage.SET_DECISION: return createSetDecision(); 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 MAVOPackage.MAY_DECISION_LOGIC: return createMayDecisionLogicFromString(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 MAVOPackage.MAY_DECISION_LOGIC: return convertMayDecisionLogicToString(eDataType, instanceValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MAVOCollection createMAVOCollection() { MAVOCollectionImpl mavoCollection = new MAVOCollectionImpl(); return mavoCollection; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MayDecision createMayDecision() { MayDecisionImpl mayDecision = new MayDecisionImpl(); return mayDecision; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public VarDecision createVarDecision() { VarDecisionImpl varDecision = new VarDecisionImpl(); return varDecision; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SetDecision createSetDecision() { SetDecisionImpl setDecision = new SetDecisionImpl(); return setDecision; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MayDecisionLogic createMayDecisionLogicFromString(EDataType eDataType, String initialValue) { MayDecisionLogic result = MayDecisionLogic.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 convertMayDecisionLogicToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MAVOPackage getMAVOPackage() { return (MAVOPackage)getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static MAVOPackage getPackage() { return MAVOPackage.eINSTANCE; } } //MAVOFactoryImpl