/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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.essentialocl.expressions.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.essentialocl.expressions.*; import org.dresdenocl.essentialocl.expressions.BooleanLiteralExp; import org.dresdenocl.essentialocl.expressions.CollectionItem; import org.dresdenocl.essentialocl.expressions.CollectionKind; import org.dresdenocl.essentialocl.expressions.CollectionLiteralExp; import org.dresdenocl.essentialocl.expressions.CollectionRange; import org.dresdenocl.essentialocl.expressions.EnumLiteralExp; import org.dresdenocl.essentialocl.expressions.ExpressionInOcl; import org.dresdenocl.essentialocl.expressions.ExpressionsFactory; import org.dresdenocl.essentialocl.expressions.IfExp; import org.dresdenocl.essentialocl.expressions.IntegerLiteralExp; import org.dresdenocl.essentialocl.expressions.InvalidLiteralExp; import org.dresdenocl.essentialocl.expressions.IterateExp; import org.dresdenocl.essentialocl.expressions.IteratorExp; import org.dresdenocl.essentialocl.expressions.LetExp; import org.dresdenocl.essentialocl.expressions.OperationCallExp; import org.dresdenocl.essentialocl.expressions.PropertyCallExp; import org.dresdenocl.essentialocl.expressions.RealLiteralExp; import org.dresdenocl.essentialocl.expressions.StringLiteralExp; import org.dresdenocl.essentialocl.expressions.TupleLiteralExp; import org.dresdenocl.essentialocl.expressions.TupleLiteralPart; import org.dresdenocl.essentialocl.expressions.TypeLiteralExp; import org.dresdenocl.essentialocl.expressions.UndefinedLiteralExp; import org.dresdenocl.essentialocl.expressions.UnlimitedNaturalExp; import org.dresdenocl.essentialocl.expressions.Variable; import org.dresdenocl.essentialocl.expressions.VariableExp; /** * <!-- begin-user-doc --> * An implementation of the model <b>Factory</b>. * <!-- end-user-doc --> * @generated */ public class ExpressionsFactoryImpl extends EFactoryImpl implements ExpressionsFactory { /** * The singleton instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final ExpressionsFactoryImpl eINSTANCE = init(); /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ExpressionsFactoryImpl init() { try { ExpressionsFactoryImpl theExpressionsFactory = (ExpressionsFactoryImpl) EPackage.Registry.INSTANCE .getEFactory(ExpressionsPackageImpl.eNS_URI); if (theExpressionsFactory != null) { return theExpressionsFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new ExpressionsFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ExpressionsFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case ExpressionsPackageImpl.VARIABLE_EXP: return createVariableExp(); case ExpressionsPackageImpl.VARIABLE: return createVariable(); case ExpressionsPackageImpl.UNLIMITED_NATURAL_EXP: return createUnlimitedNaturalExp(); case ExpressionsPackageImpl.TYPE_LITERAL_EXP: return createTypeLiteralExp(); case ExpressionsPackageImpl.TUPLE_LITERAL_PART: return createTupleLiteralPart(); case ExpressionsPackageImpl.TUPLE_LITERAL_EXP: return createTupleLiteralExp(); case ExpressionsPackageImpl.STRING_LITERAL_EXP: return createStringLiteralExp(); case ExpressionsPackageImpl.REAL_LITERAL_EXP: return createRealLiteralExp(); case ExpressionsPackageImpl.PROPERTY_CALL_EXP: return createPropertyCallExp(); case ExpressionsPackageImpl.OPERATION_CALL_EXP: return createOperationCallExp(); case ExpressionsPackageImpl.UNDEFINED_LITERAL_EXP: return createUndefinedLiteralExp(); case ExpressionsPackageImpl.LET_EXP: return createLetExp(); case ExpressionsPackageImpl.ITERATOR_EXP: return createIteratorExp(); case ExpressionsPackageImpl.ITERATE_EXP: return createIterateExp(); case ExpressionsPackageImpl.INVALID_LITERAL_EXP: return createInvalidLiteralExp(); case ExpressionsPackageImpl.INTEGER_LITERAL_EXP: return createIntegerLiteralExp(); case ExpressionsPackageImpl.IF_EXP: return createIfExp(); case ExpressionsPackageImpl.BOOLEAN_LITERAL_EXP: return createBooleanLiteralExp(); case ExpressionsPackageImpl.COLLECTION_ITEM: return createCollectionItem(); case ExpressionsPackageImpl.COLLECTION_LITERAL_EXP: return createCollectionLiteralExp(); case ExpressionsPackageImpl.COLLECTION_RANGE: return createCollectionRange(); case ExpressionsPackageImpl.ENUM_LITERAL_EXP: return createEnumLiteralExp(); case ExpressionsPackageImpl.EXPRESSION_IN_OCL: return createExpressionInOcl(); 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 ExpressionsPackageImpl.COLLECTION_KIND: return createCollectionKindFromString(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 ExpressionsPackageImpl.COLLECTION_KIND: return convertCollectionKindToString(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 */ public VariableExp createVariableExp() { VariableExpImpl variableExp = new VariableExpImpl(); return variableExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Variable createVariable() { VariableImpl variable = new VariableImpl(); return variable; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public UnlimitedNaturalExp createUnlimitedNaturalExp() { UnlimitedNaturalExpImpl unlimitedNaturalExp = new UnlimitedNaturalExpImpl(); return unlimitedNaturalExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TypeLiteralExp createTypeLiteralExp() { TypeLiteralExpImpl typeLiteralExp = new TypeLiteralExpImpl(); return typeLiteralExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TupleLiteralPart createTupleLiteralPart() { TupleLiteralPartImpl tupleLiteralPart = new TupleLiteralPartImpl(); return tupleLiteralPart; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TupleLiteralExp createTupleLiteralExp() { TupleLiteralExpImpl tupleLiteralExp = new TupleLiteralExpImpl(); return tupleLiteralExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public StringLiteralExp createStringLiteralExp() { StringLiteralExpImpl stringLiteralExp = new StringLiteralExpImpl(); return stringLiteralExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RealLiteralExp createRealLiteralExp() { RealLiteralExpImpl realLiteralExp = new RealLiteralExpImpl(); return realLiteralExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public PropertyCallExp createPropertyCallExp() { PropertyCallExpImpl propertyCallExp = new PropertyCallExpImpl(); return propertyCallExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public OperationCallExp createOperationCallExp() { OperationCallExpImpl operationCallExp = new OperationCallExpImpl(); return operationCallExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public UndefinedLiteralExp createUndefinedLiteralExp() { UndefinedLiteralExpImpl undefinedLiteralExp = new UndefinedLiteralExpImpl(); return undefinedLiteralExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public LetExp createLetExp() { LetExpImpl letExp = new LetExpImpl(); return letExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IteratorExp createIteratorExp() { IteratorExpImpl iteratorExp = new IteratorExpImpl(); return iteratorExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IterateExp createIterateExp() { IterateExpImpl iterateExp = new IterateExpImpl(); return iterateExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public InvalidLiteralExp createInvalidLiteralExp() { InvalidLiteralExpImpl invalidLiteralExp = new InvalidLiteralExpImpl(); return invalidLiteralExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IntegerLiteralExp createIntegerLiteralExp() { IntegerLiteralExpImpl integerLiteralExp = new IntegerLiteralExpImpl(); return integerLiteralExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IfExp createIfExp() { IfExpImpl ifExp = new IfExpImpl(); return ifExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public BooleanLiteralExp createBooleanLiteralExp() { BooleanLiteralExpImpl booleanLiteralExp = new BooleanLiteralExpImpl(); return booleanLiteralExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public CollectionItem createCollectionItem() { CollectionItemImpl collectionItem = new CollectionItemImpl(); return collectionItem; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public CollectionLiteralExp createCollectionLiteralExp() { CollectionLiteralExpImpl collectionLiteralExp = new CollectionLiteralExpImpl(); return collectionLiteralExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public CollectionRange createCollectionRange() { CollectionRangeImpl collectionRange = new CollectionRangeImpl(); return collectionRange; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EnumLiteralExp createEnumLiteralExp() { EnumLiteralExpImpl enumLiteralExp = new EnumLiteralExpImpl(); return enumLiteralExp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ExpressionInOcl createExpressionInOcl() { ExpressionInOclImpl expressionInOcl = new ExpressionInOclImpl(); return expressionInOcl; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public CollectionKind createCollectionKindFromString(EDataType eDataType, String initialValue) { CollectionKind result = CollectionKind.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 */ public String convertCollectionKindToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ExpressionsPackageImpl getExpressionsPackage() { return (ExpressionsPackageImpl) getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static ExpressionsPackageImpl getPackage() { return ExpressionsPackageImpl.eINSTANCE; } } //ExpressionsFactoryImpl