blob: 8bf70c8dedbbcc271b590e9ba43cb5faea819053 [file] [log] [blame]
/*****************************************************************************
* Copyright (c) 2011, 2015 University of Padova, Intecs
*
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
*
*****************************************************************************/
package org.polarsys.chess.chessmlprofile.Dependability.DependableComponent.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.polarsys.chess.chessmlprofile.Dependability.DependableComponent.*;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Factory</b>.
* <!-- end-user-doc -->
* @generated
*/
public class DependableComponentFactoryImpl extends EFactoryImpl implements DependableComponentFactory {
/**
* Creates the default factory implementation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static DependableComponentFactory init() {
try {
DependableComponentFactory theDependableComponentFactory = (DependableComponentFactory)EPackage.Registry.INSTANCE.getEFactory(DependableComponentPackage.eNS_URI);
if (theDependableComponentFactory != null) {
return theDependableComponentFactory;
}
}
catch (Exception exception) {
EcorePlugin.INSTANCE.log(exception);
}
return new DependableComponentFactoryImpl();
}
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DependableComponentFactoryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case DependableComponentPackage.FAILURE_MODES: return createFailureModes();
case DependableComponentPackage.DEPENDABLE_COMPONENT: return createDependableComponent();
case DependableComponentPackage.ERROR_MODEL_BEHAVIOR: return createErrorModelBehavior();
case DependableComponentPackage.THREAT: return createThreat();
case DependableComponentPackage.ANALYSIS_CONTEXT_ELEMENT: return createAnalysisContextElement();
case DependableComponentPackage.PROPAGATION: return createPropagation();
case DependableComponentPackage.FAILURE_MODE: return createFailureMode();
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 DependableComponentPackage.ATTACK_TYPE:
return createAttackTypeFromString(eDataType, initialValue);
case DependableComponentPackage.VULNERABILITY_TYPE:
return createVulnerabilityTypeFromString(eDataType, initialValue);
case DependableComponentPackage.THREAT_TYPE:
return createThreatTypeFromString(eDataType, initialValue);
case DependableComponentPackage.ANALYSIS:
return createAnalysisFromString(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 DependableComponentPackage.ATTACK_TYPE:
return convertAttackTypeToString(eDataType, instanceValue);
case DependableComponentPackage.VULNERABILITY_TYPE:
return convertVulnerabilityTypeToString(eDataType, instanceValue);
case DependableComponentPackage.THREAT_TYPE:
return convertThreatTypeToString(eDataType, instanceValue);
case DependableComponentPackage.ANALYSIS:
return convertAnalysisToString(eDataType, instanceValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FailureModes createFailureModes() {
FailureModesImpl failureModes = new FailureModesImpl();
return failureModes;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FailureMode createFailureMode() {
FailureModeImpl failureMode = new FailureModeImpl();
return failureMode;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AttackType createAttackTypeFromString(EDataType eDataType, String initialValue) {
AttackType result = AttackType.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 convertAttackTypeToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public VulnerabilityType createVulnerabilityTypeFromString(EDataType eDataType, String initialValue) {
VulnerabilityType result = VulnerabilityType.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 convertVulnerabilityTypeToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ThreatType createThreatTypeFromString(EDataType eDataType, String initialValue) {
ThreatType result = ThreatType.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 convertThreatTypeToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Analysis createAnalysisFromString(EDataType eDataType, String initialValue) {
Analysis result = Analysis.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 convertAnalysisToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DependableComponent createDependableComponent() {
DependableComponentImpl dependableComponent = new DependableComponentImpl();
return dependableComponent;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Threat createThreat() {
ThreatImpl threat = new ThreatImpl();
return threat;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AnalysisContextElement createAnalysisContextElement() {
AnalysisContextElementImpl analysisContextElement = new AnalysisContextElementImpl();
return analysisContextElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ErrorModelBehavior createErrorModelBehavior() {
ErrorModelBehaviorImpl errorModelBehavior = new ErrorModelBehaviorImpl();
return errorModelBehavior;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Propagation createPropagation() {
PropagationImpl propagation = new PropagationImpl();
return propagation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DependableComponentPackage getDependableComponentPackage() {
return (DependableComponentPackage)getEPackage();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @deprecated
* @generated
*/
@Deprecated
public static DependableComponentPackage getPackage() {
return DependableComponentPackage.eINSTANCE;
}
} //DependableComponentFactoryImpl