package com.ms.qaTools.saturn.modules.runcmdsModule.impl;

import com.ms.qaTools.saturn.modules.runcmdsModule.*;
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 com.ms.qaTools.saturn.modules.runcmdsModule.CheckStrActionEnum;
import com.ms.qaTools.saturn.modules.runcmdsModule.Command;
import com.ms.qaTools.saturn.modules.runcmdsModule.DocumentRoot;
import com.ms.qaTools.saturn.modules.runcmdsModule.RunCmdsConfiguration;
import com.ms.qaTools.saturn.modules.runcmdsModule.RuncmdsModuleFactory;
import com.ms.qaTools.saturn.modules.runcmdsModule.RuncmdsModulePackage;

/**
 * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- end-user-doc -->
 * @generated
 */
public class RuncmdsModuleFactoryImpl extends EFactoryImpl implements RuncmdsModuleFactory
{
  /**
   * Creates the default factory implementation.
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * @generated
   */
  public static RuncmdsModuleFactory init()
  {
    try
    {
      RuncmdsModuleFactory theRuncmdsModuleFactory = (RuncmdsModuleFactory)EPackage.Registry.INSTANCE.getEFactory(RuncmdsModulePackage.eNS_URI);
      if (theRuncmdsModuleFactory != null)
      {
        return theRuncmdsModuleFactory;
      }
    }
    catch (Exception exception)
    {
      EcorePlugin.INSTANCE.log(exception);
    }
    return new RuncmdsModuleFactoryImpl();
  }

  /**
   * Creates an instance of the factory.
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * @generated
   */
  public RuncmdsModuleFactoryImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * @generated
   */
  @Override
  public EObject create(EClass eClass)
  {
    switch (eClass.getClassifierID())
    {
      case RuncmdsModulePackage.COMMAND: return createCommand();
      case RuncmdsModulePackage.DOCUMENT_ROOT: return createDocumentRoot();
      case RuncmdsModulePackage.RUN_CMDS_CONFIGURATION: return createRunCmdsConfiguration();
      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 RuncmdsModulePackage.CHECK_STR_ACTION_ENUM:
        return createCheckStrActionEnumFromString(eDataType, initialValue);
      case RuncmdsModulePackage.CHECK_STR_ACTION_ENUM_OBJECT:
        return createCheckStrActionEnumObjectFromString(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 RuncmdsModulePackage.CHECK_STR_ACTION_ENUM:
        return convertCheckStrActionEnumToString(eDataType, instanceValue);
      case RuncmdsModulePackage.CHECK_STR_ACTION_ENUM_OBJECT:
        return convertCheckStrActionEnumObjectToString(eDataType, instanceValue);
      default:
        throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
    }
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * @generated
   */
  public Command createCommand()
  {
    CommandImpl command = new CommandImpl();
    return command;
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * @generated
   */
  public DocumentRoot createDocumentRoot()
  {
    DocumentRootImpl documentRoot = new DocumentRootImpl();
    return documentRoot;
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * @generated
   */
  public RunCmdsConfiguration createRunCmdsConfiguration()
  {
    RunCmdsConfigurationImpl runCmdsConfiguration = new RunCmdsConfigurationImpl();
    return runCmdsConfiguration;
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * @generated
   */
  public CheckStrActionEnum createCheckStrActionEnumFromString(EDataType eDataType, String initialValue)
  {
    CheckStrActionEnum result = CheckStrActionEnum.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 convertCheckStrActionEnumToString(EDataType eDataType, Object instanceValue)
  {
    return instanceValue == null ? null : instanceValue.toString();
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * @generated
   */
  public CheckStrActionEnum createCheckStrActionEnumObjectFromString(EDataType eDataType, String initialValue)
  {
    return createCheckStrActionEnumFromString(RuncmdsModulePackage.Literals.CHECK_STR_ACTION_ENUM, initialValue);
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * @generated
   */
  public String convertCheckStrActionEnumObjectToString(EDataType eDataType, Object instanceValue)
  {
    return convertCheckStrActionEnumToString(RuncmdsModulePackage.Literals.CHECK_STR_ACTION_ENUM, instanceValue);
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * @generated
   */
  public RuncmdsModulePackage getRuncmdsModulePackage()
  {
    return (RuncmdsModulePackage)getEPackage();
  }

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * @deprecated
   * @generated
   */
  @Deprecated
  public static RuncmdsModulePackage getPackage()
  {
    return RuncmdsModulePackage.eINSTANCE;
  }

} // RuncmdsModuleFactoryImpl
/*
Copyright 2017 Morgan Stanley

Licensed under the GNU Lesser General Public License Version 3 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.gnu.org/licenses/lgpl-3.0.en.html

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

IN ADDITION, THE FOLLOWING DISCLAIMER APPLIES IN CONNECTION WITH THIS PROGRAM:

THIS SOFTWARE IS LICENSED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY
WARRANTY OF NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE. THIS SOFTWARE MAY BE REDISTRIBUTED TO OTHERS ONLY BY EFFECTIVELY
USING THIS OR ANOTHER EQUIVALENT DISCLAIMER IN ADDITION TO ANY OTHER REQUIRED
LICENSE TERMS.
*/