| /******************************************************************************* |
| * Copyright (c) 2014, 2019 Willink Transformations and others. |
| * 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 |
| * |
| * Contributors: |
| * E.D.Willink - initial API and implementation |
| *******************************************************************************/ |
| /** |
| */ |
| package org.eclipse.ocl.pivot.oclstdlib; |
| |
| 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.ocl.pivot.values.IntegerValue; |
| import org.eclipse.ocl.pivot.values.RealValue; |
| import org.eclipse.ocl.pivot.values.UnlimitedNaturalValue; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * The <b>Factory</b> for the model. |
| * It provides a create method for each non-abstract class of the model. |
| * <!-- end-user-doc --> |
| * @see org.eclipse.ocl.pivot.oclstdlib.OCLstdlibPackage |
| * @generated |
| */ |
| public class OCLstdlibFactory extends EFactoryImpl { |
| /** |
| * The singleton instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static final OCLstdlibFactory eINSTANCE = init(); |
| |
| /** |
| * Creates the default factory implementation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static OCLstdlibFactory init() { |
| try { |
| OCLstdlibFactory theOCLstdlibFactory = (OCLstdlibFactory)EPackage.Registry.INSTANCE.getEFactory(OCLstdlibPackage.eNS_URI); |
| if (theOCLstdlibFactory != null) { |
| return theOCLstdlibFactory; |
| } |
| } |
| catch (Exception exception) { |
| EcorePlugin.INSTANCE.log(exception); |
| } |
| return new OCLstdlibFactory(); |
| } |
| |
| /** |
| * Creates an instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public OCLstdlibFactory() { |
| 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"); //$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 22: |
| return createBooleanFromString(eDataType, initialValue); |
| case 23: |
| return createIntegerFromString(eDataType, initialValue); |
| case 24: |
| return createRealFromString(eDataType, initialValue); |
| case 25: |
| return createStringFromString(eDataType, initialValue); |
| case 26: |
| return createUnlimitedNaturalFromString(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 22: |
| return convertBooleanToString(eDataType, instanceValue); |
| case 23: |
| return convertIntegerToString(eDataType, instanceValue); |
| case 24: |
| return convertRealToString(eDataType, instanceValue); |
| case 25: |
| return convertStringToString(eDataType, instanceValue); |
| case 26: |
| return convertUnlimitedNaturalToString(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 Boolean createBooleanFromString(EDataType eDataType, String initialValue) { |
| return (Boolean)super.createFromString(eDataType, initialValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String convertBooleanToString(EDataType eDataType, Object instanceValue) { |
| return super.convertToString(eDataType, instanceValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public IntegerValue createIntegerFromString(EDataType eDataType, String initialValue) { |
| return (IntegerValue)super.createFromString(eDataType, initialValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String convertIntegerToString(EDataType eDataType, Object instanceValue) { |
| return super.convertToString(eDataType, instanceValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public RealValue createRealFromString(EDataType eDataType, String initialValue) { |
| return (RealValue)super.createFromString(eDataType, initialValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String convertRealToString(EDataType eDataType, Object instanceValue) { |
| return super.convertToString(eDataType, instanceValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String createStringFromString(EDataType eDataType, String initialValue) { |
| return (String)super.createFromString(eDataType, initialValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String convertStringToString(EDataType eDataType, Object instanceValue) { |
| return super.convertToString(eDataType, instanceValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public UnlimitedNaturalValue createUnlimitedNaturalFromString(EDataType eDataType, String initialValue) { |
| return (UnlimitedNaturalValue)super.createFromString(eDataType, initialValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String convertUnlimitedNaturalToString(EDataType eDataType, Object instanceValue) { |
| return super.convertToString(eDataType, instanceValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public OCLstdlibPackage getOCLstdlibPackage() { |
| return (OCLstdlibPackage)getEPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @deprecated |
| * @generated |
| */ |
| @Deprecated |
| public static OCLstdlibPackage getPackage() { |
| return OCLstdlibPackage.eINSTANCE; |
| } |
| |
| } //OCLstdlibFactory |