/** * <copyright> * </copyright> * * $Id$ */ package fr.inria.atlanmod.collaboro.notation.impl; import fr.inria.atlanmod.collaboro.notation.*; 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 NotationFactoryImpl extends EFactoryImpl implements NotationFactory { /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static NotationFactory init() { try { NotationFactory theNotationFactory = (NotationFactory)EPackage.Registry.INSTANCE.getEFactory("http://atlanmod.fr/collaboro/notation"); if (theNotationFactory != null) { return theNotationFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new NotationFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotationFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case NotationPackage.IMAGE: return createImage(); case NotationPackage.RECTANGLE: return createRectangle(); case NotationPackage.LINE: return createLine(); case NotationPackage.LABEL: return createLabel(); case NotationPackage.TEXTUAL_ELEMENT: return createTextualElement(); case NotationPackage.TOKEN: return createToken(); case NotationPackage.KEYWORD: return createKeyword(); case NotationPackage.ATTRIBUTE_VALUE: return createAttributeValue(); case NotationPackage.REFERENCE_VALUE: return createReferenceValue(); case NotationPackage.SYNTAX_OF: return createSyntaxOf(); case NotationPackage.COMPOSITE: return createComposite(); case NotationPackage.DEFINITION: return createDefinition(); 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 NotationPackage.COLOR: return createColorFromString(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 NotationPackage.COLOR: return convertColorToString(eDataType, instanceValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Image createImage() { ImageImpl image = new ImageImpl(); return image; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Rectangle createRectangle() { RectangleImpl rectangle = new RectangleImpl(); return rectangle; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Line createLine() { LineImpl line = new LineImpl(); return line; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Label createLabel() { LabelImpl label = new LabelImpl(); return label; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TextualElement createTextualElement() { TextualElementImpl textualElement = new TextualElementImpl(); return textualElement; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Token createToken() { TokenImpl token = new TokenImpl(); return token; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Keyword createKeyword() { KeywordImpl keyword = new KeywordImpl(); return keyword; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AttributeValue createAttributeValue() { AttributeValueImpl attributeValue = new AttributeValueImpl(); return attributeValue; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ReferenceValue createReferenceValue() { ReferenceValueImpl referenceValue = new ReferenceValueImpl(); return referenceValue; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SyntaxOf createSyntaxOf() { SyntaxOfImpl syntaxOf = new SyntaxOfImpl(); return syntaxOf; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Composite createComposite() { CompositeImpl composite = new CompositeImpl(); return composite; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Definition createDefinition() { DefinitionImpl definition = new DefinitionImpl(); return definition; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Color createColorFromString(EDataType eDataType, String initialValue) { Color result = Color.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 convertColorToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotationPackage getNotationPackage() { return (NotationPackage)getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static NotationPackage getPackage() { return NotationPackage.eINSTANCE; } } //NotationFactoryImpl