001 /**
002 * <copyright>
003 * </copyright>
004 *
005 * $Id$
006 */
007 package com.hammurapi.reasoning.spi.model.impl;
008
009 import com.hammurapi.reasoning.spi.model.*;
010
011 import org.eclipse.emf.ecore.EClass;
012 import org.eclipse.emf.ecore.EObject;
013 import org.eclipse.emf.ecore.EPackage;
014
015 import org.eclipse.emf.ecore.impl.EFactoryImpl;
016
017 import org.eclipse.emf.ecore.plugin.EcorePlugin;
018
019 /**
020 * <!-- begin-user-doc -->
021 * An implementation of the model <b>Factory</b>.
022 * <!-- end-user-doc -->
023 * @generated
024 */
025 public class ModelFactoryImpl extends EFactoryImpl implements ModelFactory {
026 /**
027 * Creates the default factory implementation.
028 * <!-- begin-user-doc -->
029 * <!-- end-user-doc -->
030 * @generated
031 */
032 public static ModelFactory init() {
033 try {
034 ModelFactory theModelFactory = (ModelFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.hammurapi.com/reasoning/spi/model");
035 if (theModelFactory != null) {
036 return theModelFactory;
037 }
038 }
039 catch (Exception exception) {
040 EcorePlugin.INSTANCE.log(exception);
041 }
042 return new ModelFactoryImpl();
043 }
044
045 /**
046 * Creates an instance of the factory.
047 * <!-- begin-user-doc -->
048 * <!-- end-user-doc -->
049 * @generated
050 */
051 public ModelFactoryImpl() {
052 super();
053 }
054
055 /**
056 * <!-- begin-user-doc -->
057 * <!-- end-user-doc -->
058 * @generated
059 */
060 @Override
061 public EObject create(EClass eClass) {
062 switch (eClass.getClassifierID()) {
063 case ModelPackage.RULE_SET: return createRuleSet();
064 case ModelPackage.RULE: return createRule();
065 default:
066 throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
067 }
068 }
069
070 /**
071 * <!-- begin-user-doc -->
072 * <!-- end-user-doc -->
073 * @generated
074 */
075 public RuleSet createRuleSet() {
076 RuleSetImpl ruleSet = new RuleSetImpl();
077 return ruleSet;
078 }
079
080 /**
081 * <!-- begin-user-doc -->
082 * <!-- end-user-doc -->
083 * @generated
084 */
085 public Rule createRule() {
086 RuleImpl rule = new RuleImpl();
087 return rule;
088 }
089
090 /**
091 * <!-- begin-user-doc -->
092 * <!-- end-user-doc -->
093 * @generated
094 */
095 public ModelPackage getModelPackage() {
096 return (ModelPackage)getEPackage();
097 }
098
099 /**
100 * <!-- begin-user-doc -->
101 * <!-- end-user-doc -->
102 * @deprecated
103 * @generated
104 */
105 @Deprecated
106 public static ModelPackage getPackage() {
107 return ModelPackage.eINSTANCE;
108 }
109
110 } //ModelFactoryImpl