blob: 5425d96801e787d13fccff7936d408b7ef55c5cb [file] [log] [blame]
/**
* * Copyright (c) 2006-2010 Istvan Rath and Daniel Varro
* * 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:
* * Istvan Rath, Daniel Varro - initial API and implementation
*
*/
package org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.enums.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.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.enums.*;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Factory</b>.
* <!-- end-user-doc -->
* @generated
*/
public class EnumsFactoryImpl extends EFactoryImpl implements EnumsFactory
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String copyright = " * Copyright (c) 2006-2010 Istvan Rath and Daniel Varro\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors:\r\n * Istvan Rath, Daniel Varro - initial API and implementation\r\n";
/**
* Creates the default factory implementation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static EnumsFactory init()
{
try
{
EnumsFactory theEnumsFactory = (EnumsFactory)EPackage.Registry.INSTANCE.getEFactory("http:///viatragtasmmodel/gtasm/metamodel/asm/enums.ecore");
if (theEnumsFactory != null)
{
return theEnumsFactory;
}
}
catch (Exception exception)
{
EcorePlugin.INSTANCE.log(exception);
}
return new EnumsFactoryImpl();
}
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EnumsFactoryImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EObject create(EClass eClass)
{
switch (eClass.getClassifierID())
{
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 EnumsPackage.COPY_SEMANTICS:
return createCopySemanticsFromString(eDataType, initialValue);
case EnumsPackage.DELETE_SEMANTICS:
return createDeleteSemanticsFromString(eDataType, initialValue);
case EnumsPackage.LOG_LEVEL:
return createLogLevelFromString(eDataType, initialValue);
case EnumsPackage.CONTAINMENT_MODE:
return createContainmentModeFromString(eDataType, initialValue);
case EnumsPackage.VALUE_KIND:
return createValueKindFromString(eDataType, initialValue);
case EnumsPackage.DIRECTION_KIND:
return createDirectionKindFromString(eDataType, initialValue);
case EnumsPackage.MULTIPLICITY_KIND:
return createMultiplicityKindFromString(eDataType, initialValue);
case EnumsPackage.CHANGE_KIND:
return createChangeKindFromString(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 EnumsPackage.COPY_SEMANTICS:
return convertCopySemanticsToString(eDataType, instanceValue);
case EnumsPackage.DELETE_SEMANTICS:
return convertDeleteSemanticsToString(eDataType, instanceValue);
case EnumsPackage.LOG_LEVEL:
return convertLogLevelToString(eDataType, instanceValue);
case EnumsPackage.CONTAINMENT_MODE:
return convertContainmentModeToString(eDataType, instanceValue);
case EnumsPackage.VALUE_KIND:
return convertValueKindToString(eDataType, instanceValue);
case EnumsPackage.DIRECTION_KIND:
return convertDirectionKindToString(eDataType, instanceValue);
case EnumsPackage.MULTIPLICITY_KIND:
return convertMultiplicityKindToString(eDataType, instanceValue);
case EnumsPackage.CHANGE_KIND:
return convertChangeKindToString(eDataType, instanceValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CopySemantics createCopySemanticsFromString(EDataType eDataType, String initialValue)
{
CopySemantics result = CopySemantics.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 convertCopySemanticsToString(EDataType eDataType, Object instanceValue)
{
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DeleteSemantics createDeleteSemanticsFromString(EDataType eDataType, String initialValue)
{
DeleteSemantics result = DeleteSemantics.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 convertDeleteSemanticsToString(EDataType eDataType, Object instanceValue)
{
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LogLevel createLogLevelFromString(EDataType eDataType, String initialValue)
{
LogLevel result = LogLevel.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 convertLogLevelToString(EDataType eDataType, Object instanceValue)
{
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ContainmentMode createContainmentModeFromString(EDataType eDataType, String initialValue)
{
ContainmentMode result = ContainmentMode.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 convertContainmentModeToString(EDataType eDataType, Object instanceValue)
{
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ValueKind createValueKindFromString(EDataType eDataType, String initialValue)
{
ValueKind result = ValueKind.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 convertValueKindToString(EDataType eDataType, Object instanceValue)
{
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DirectionKind createDirectionKindFromString(EDataType eDataType, String initialValue)
{
DirectionKind result = DirectionKind.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 convertDirectionKindToString(EDataType eDataType, Object instanceValue)
{
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public MultiplicityKind createMultiplicityKindFromString(EDataType eDataType, String initialValue)
{
MultiplicityKind result = MultiplicityKind.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 convertMultiplicityKindToString(EDataType eDataType, Object instanceValue)
{
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChangeKind createChangeKindFromString(EDataType eDataType, String initialValue)
{
ChangeKind result = ChangeKind.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 convertChangeKindToString(EDataType eDataType, Object instanceValue)
{
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EnumsPackage getEnumsPackage()
{
return (EnumsPackage)getEPackage();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @deprecated
* @generated
*/
@Deprecated
public static EnumsPackage getPackage()
{
return EnumsPackage.eINSTANCE;
}
} //EnumsFactoryImpl