/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright (C) 2007 Matthias Braeuer (braeuer.matthias@web.de). * * All rights reserved. * * * * This work was done as a project at the Chair for Software Technology, * * Dresden University Of Technology, Germany (http://st.inf.tu-dresden.de). * * It is understood that any modification not identified as such is not * * covered by the preceding statement. * * * * This work is free software; you can redistribute it and/or modify it * * under the terms of the GNU Library General Public License as published * * by the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This work is distributed in the hope that it will be useful, but WITHOUT * * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public * * License for more details. * * * * You should have received a copy of the GNU Library General Public License * * along with this library; if not, you can view it online at * * http://www.fsf.org/licensing/licenses/gpl.html. * * * * To submit a bug report, send a comment, or get the latest news on this * * project, please visit the website: http://dresden-ocl.sourceforge.net. * * For more information on OCL and related projects visit the OCL Portal: * * http://st.inf.tu-dresden.de/ocl * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * $Id$ */ package org.dresdenocl.pivotmodel.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.dresdenocl.pivotmodel.AssociationProperty; import org.dresdenocl.pivotmodel.ComplexGenericType; import org.dresdenocl.pivotmodel.Constraint; import org.dresdenocl.pivotmodel.ConstraintKind; import org.dresdenocl.pivotmodel.Enumeration; import org.dresdenocl.pivotmodel.EnumerationLiteral; import org.dresdenocl.pivotmodel.Expression; import org.dresdenocl.pivotmodel.Namespace; import org.dresdenocl.pivotmodel.Operation; import org.dresdenocl.pivotmodel.Parameter; import org.dresdenocl.pivotmodel.ParameterDirectionKind; import org.dresdenocl.pivotmodel.ParameterGenericType; import org.dresdenocl.pivotmodel.PivotModelFactory; import org.dresdenocl.pivotmodel.PivotModelPackage; import org.dresdenocl.pivotmodel.PrimitiveType; import org.dresdenocl.pivotmodel.PrimitiveTypeKind; import org.dresdenocl.pivotmodel.Property; import org.dresdenocl.pivotmodel.Type; import org.dresdenocl.pivotmodel.TypeArgument; import org.dresdenocl.pivotmodel.TypeParameter; /** * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- * end-user-doc --> * @generated */ public class PivotModelFactoryImpl extends EFactoryImpl implements PivotModelFactory { /** * Creates the default factory implementation. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated */ public static PivotModelFactory init() { try { PivotModelFactory thePivotModelFactory = (PivotModelFactory) EPackage.Registry.INSTANCE .getEFactory("http://www.tu-dresden.de/ocl20/pivot/2007/pivotmodel"); //$NON-NLS-1$ if (thePivotModelFactory != null) { return thePivotModelFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new PivotModelFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @generated */ public PivotModelFactoryImpl() { super(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case PivotModelPackage.NAMESPACE: return createNamespace(); case PivotModelPackage.TYPE: return createType(); case PivotModelPackage.PRIMITIVE_TYPE: return createPrimitiveType(); case PivotModelPackage.ENUMERATION: return createEnumeration(); case PivotModelPackage.ENUMERATION_LITERAL: return createEnumerationLiteral(); case PivotModelPackage.PROPERTY: return createProperty(); case PivotModelPackage.OPERATION: return createOperation(); case PivotModelPackage.PARAMETER: return createParameter(); case PivotModelPackage.PARAMETER_GENERIC_TYPE: return createParameterGenericType(); case PivotModelPackage.COMPLEX_GENERIC_TYPE: return createComplexGenericType(); case PivotModelPackage.TYPE_PARAMETER: return createTypeParameter(); case PivotModelPackage.TYPE_ARGUMENT: return createTypeArgument(); case PivotModelPackage.CONSTRAINT: return createConstraint(); case PivotModelPackage.EXPRESSION: return createExpression(); case PivotModelPackage.ASSOCIATION_PROPERTY: return createAssociationProperty(); default: throw new IllegalArgumentException( "The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ } } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public Object createFromString(EDataType eDataType, String initialValue) { switch (eDataType.getClassifierID()) { case PivotModelPackage.PRIMITIVE_TYPE_KIND: return createPrimitiveTypeKindFromString(eDataType, initialValue); case PivotModelPackage.PARAMETER_DIRECTION_KIND: return createParameterDirectionKindFromString(eDataType, initialValue); case PivotModelPackage.CONSTRAINT_KIND: return createConstraintKindFromString(eDataType, initialValue); default: throw new IllegalArgumentException( "The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ } } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public String convertToString(EDataType eDataType, Object instanceValue) { switch (eDataType.getClassifierID()) { case PivotModelPackage.PRIMITIVE_TYPE_KIND: return convertPrimitiveTypeKindToString(eDataType, instanceValue); case PivotModelPackage.PARAMETER_DIRECTION_KIND: return convertParameterDirectionKindToString(eDataType, instanceValue); case PivotModelPackage.CONSTRAINT_KIND: return convertConstraintKindToString(eDataType, instanceValue); default: throw new IllegalArgumentException( "The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ } } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public Enumeration createEnumeration() { EnumerationImpl enumeration = new EnumerationImpl(); return enumeration; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public Operation createOperation() { OperationImpl operation = new OperationImpl(); return operation; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public Namespace createNamespace() { NamespaceImpl namespace = new NamespaceImpl(); return namespace; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public Type createType() { TypeImpl type = new TypeImpl(); return type; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public Parameter createParameter() { ParameterImpl parameter = new ParameterImpl(); return parameter; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public EnumerationLiteral createEnumerationLiteral() { EnumerationLiteralImpl enumerationLiteral = new EnumerationLiteralImpl(); return enumerationLiteral; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public Property createProperty() { PropertyImpl property = new PropertyImpl(); return property; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public PrimitiveType createPrimitiveType() { PrimitiveTypeImpl primitiveType = new PrimitiveTypeImpl(); return primitiveType; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public Constraint createConstraint() { ConstraintImpl constraint = new ConstraintImpl(); return constraint; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public Expression createExpression() { ExpressionImpl expression = new ExpressionImpl(); return expression; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public AssociationProperty createAssociationProperty() { AssociationPropertyImpl associationProperty = new AssociationPropertyImpl(); return associationProperty; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public TypeParameter createTypeParameter() { TypeParameterImpl typeParameter = new TypeParameterImpl(); return typeParameter; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public TypeArgument createTypeArgument() { TypeArgumentImpl typeArgument = new TypeArgumentImpl(); return typeArgument; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public ParameterGenericType createParameterGenericType() { ParameterGenericTypeImpl parameterGenericType = new ParameterGenericTypeImpl(); return parameterGenericType; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public ComplexGenericType createComplexGenericType() { ComplexGenericTypeImpl complexGenericType = new ComplexGenericTypeImpl(); return complexGenericType; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public ParameterDirectionKind createParameterDirectionKindFromString( EDataType eDataType, String initialValue) { ParameterDirectionKind result = ParameterDirectionKind.get(initialValue); if (result == null) throw new IllegalArgumentException( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return result; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @SuppressWarnings("unused") public String convertParameterDirectionKindToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public ConstraintKind createConstraintKindFromString(EDataType eDataType, String initialValue) { ConstraintKind result = ConstraintKind.get(initialValue); if (result == null) throw new IllegalArgumentException( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return result; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @SuppressWarnings("unused") public String convertConstraintKindToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public PivotModelPackage getPivotModelPackage() { return (PivotModelPackage) getEPackage(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public PrimitiveTypeKind createPrimitiveTypeKindFromString( EDataType eDataType, String initialValue) { PrimitiveTypeKind result = PrimitiveTypeKind.get(initialValue); if (result == null) throw new IllegalArgumentException( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return result; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @SuppressWarnings("unused") public String convertPrimitiveTypeKindToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static PivotModelPackage getPackage() { return PivotModelPackage.eINSTANCE; } } // PivotModelFactoryImpl