/** * Copyright (c) 2007, 2009 Borland Software Corporation and others. * * 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: * Borland Software Corporation - initial API and implementation * * $Id: TraceFactoryImpl.java,v 1.3 2009/05/15 12:04:09 radvorak Exp $ */ package org.eclipse.m2m.internal.qvt.oml.trace.impl; import java.util.Map; import org.eclipse.emf.common.util.EList; 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.m2m.internal.qvt.oml.expressions.MappingOperation; import org.eclipse.m2m.internal.qvt.oml.trace.EDirectionKind; import org.eclipse.m2m.internal.qvt.oml.trace.EMappingContext; import org.eclipse.m2m.internal.qvt.oml.trace.EMappingOperation; import org.eclipse.m2m.internal.qvt.oml.trace.EMappingParameters; import org.eclipse.m2m.internal.qvt.oml.trace.EMappingResults; import org.eclipse.m2m.internal.qvt.oml.trace.ETuplePartValue; import org.eclipse.m2m.internal.qvt.oml.trace.EValue; import org.eclipse.m2m.internal.qvt.oml.trace.Trace; import org.eclipse.m2m.internal.qvt.oml.trace.TraceFactory; import org.eclipse.m2m.internal.qvt.oml.trace.TracePackage; import org.eclipse.m2m.internal.qvt.oml.trace.TraceRecord; import org.eclipse.m2m.internal.qvt.oml.trace.VarParameterValue; /** * <!-- begin-user-doc --> * An implementation of the model <b>Factory</b>. * <!-- end-user-doc --> * @generated */ public class TraceFactoryImpl extends EFactoryImpl implements TraceFactory { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String copyright = "Copyright (c) 2007 Borland Software Corporation\r\n\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n \r\nContributors:\r\n Borland Software Corporation - initial API and implementation"; //$NON-NLS-1$ /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static TraceFactory init() { try { TraceFactory theTraceFactory = (TraceFactory)EPackage.Registry.INSTANCE.getEFactory(TracePackage.eNS_URI); if (theTraceFactory != null) { return theTraceFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new TraceFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TraceFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case TracePackage.TRACE: return createTrace(); case TracePackage.TRACE_RECORD: return createTraceRecord(); case TracePackage.VAR_PARAMETER_VALUE: return createVarParameterValue(); case TracePackage.MAPPING_OPERATION_TO_TRACE_RECORD_MAP_ENTRY: return (EObject)createMappingOperationToTraceRecordMapEntry(); case TracePackage.EMAPPING_OPERATION: return createEMappingOperation(); case TracePackage.EVALUE: return createEValue(); case TracePackage.ETUPLE_PART_VALUE: return createETuplePartValue(); case TracePackage.EMAPPING_CONTEXT: return createEMappingContext(); case TracePackage.EMAPPING_PARAMETERS: return createEMappingParameters(); case TracePackage.EMAPPING_RESULTS: return createEMappingResults(); case TracePackage.OBJECT_TO_TRACE_RECORD_MAP_ENTRY: return (EObject)createObjectToTraceRecordMapEntry(); 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 TracePackage.EDIRECTION_KIND: return createEDirectionKindFromString(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 TracePackage.EDIRECTION_KIND: return convertEDirectionKindToString(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 Trace createTrace() { TraceImpl trace = new TraceImpl(); return trace; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TraceRecord createTraceRecord() { TraceRecordImpl traceRecord = new TraceRecordImpl(); return traceRecord; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public VarParameterValue createVarParameterValue() { VarParameterValueImpl varParameterValue = new VarParameterValueImpl(); return varParameterValue; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Map.Entry<MappingOperation, EList<TraceRecord>> createMappingOperationToTraceRecordMapEntry() { MappingOperationToTraceRecordMapEntryImpl mappingOperationToTraceRecordMapEntry = new MappingOperationToTraceRecordMapEntryImpl(); return mappingOperationToTraceRecordMapEntry; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EMappingOperation createEMappingOperation() { EMappingOperationImpl eMappingOperation = new EMappingOperationImpl(); return eMappingOperation; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EValue createEValue() { EValueImpl eValue = new EValueImpl(); return eValue; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ETuplePartValue createETuplePartValue() { ETuplePartValueImpl eTuplePartValue = new ETuplePartValueImpl(); return eTuplePartValue; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EMappingContext createEMappingContext() { EMappingContextImpl eMappingContext = new EMappingContextImpl(); return eMappingContext; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EMappingParameters createEMappingParameters() { EMappingParametersImpl eMappingParameters = new EMappingParametersImpl(); return eMappingParameters; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EMappingResults createEMappingResults() { EMappingResultsImpl eMappingResults = new EMappingResultsImpl(); return eMappingResults; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Map.Entry<Object, EList<TraceRecord>> createObjectToTraceRecordMapEntry() { ObjectToTraceRecordMapEntryImpl objectToTraceRecordMapEntry = new ObjectToTraceRecordMapEntryImpl(); return objectToTraceRecordMapEntry; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EDirectionKind createEDirectionKindFromString(EDataType eDataType, String initialValue) { EDirectionKind result = EDirectionKind.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 convertEDirectionKindToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TracePackage getTracePackage() { return (TracePackage)getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static TracePackage getPackage() { return TracePackage.eINSTANCE; } } //TraceFactoryImpl