/** * <copyright> * Copyright (c) 2008 Open Canarias 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: * A. Sanchez-Barbudo - initial API and implementation * * </copyright> * * $Id: ModelTypeImpl.java,v 1.2 2009/01/25 23:12:23 radvorak Exp $ */ package org.eclipse.m2m.qvt.oml.ecore.QVTOperational.impl; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.EClassImpl; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.EObjectResolvingEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.m2m.qvt.oml.ecore.QVTOperational.ModelType; import org.eclipse.m2m.qvt.oml.ecore.QVTOperational.QVTOperationalPackage; import org.eclipse.ocl.ecore.OCLExpression; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Model Type</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.m2m.qvt.oml.ecore.QVTOperational.impl.ModelTypeImpl#getAdditionalCondition <em>Additional Condition</em>}</li> * <li>{@link org.eclipse.m2m.qvt.oml.ecore.QVTOperational.impl.ModelTypeImpl#getConformanceKind <em>Conformance Kind</em>}</li> * <li>{@link org.eclipse.m2m.qvt.oml.ecore.QVTOperational.impl.ModelTypeImpl#getMetamodel <em>Metamodel</em>}</li> * </ul> * </p> * * @generated */ public class ModelTypeImpl extends EClassImpl implements ModelType { /** * The cached value of the '{@link #getAdditionalCondition() <em>Additional Condition</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getAdditionalCondition() * @generated * @ordered */ protected EList<OCLExpression> additionalCondition; /** * The default value of the '{@link #getConformanceKind() <em>Conformance Kind</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getConformanceKind() * @generated * @ordered */ protected static final String CONFORMANCE_KIND_EDEFAULT = "effective"; /** * The cached value of the '{@link #getConformanceKind() <em>Conformance Kind</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getConformanceKind() * @generated * @ordered */ protected String conformanceKind = CONFORMANCE_KIND_EDEFAULT; /** * The cached value of the '{@link #getMetamodel() <em>Metamodel</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getMetamodel() * @generated * @ordered */ protected EList<EPackage> metamodel; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ModelTypeImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return QVTOperationalPackage.Literals.MODEL_TYPE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<OCLExpression> getAdditionalCondition() { if (additionalCondition == null) { additionalCondition = new EObjectContainmentEList<OCLExpression>(OCLExpression.class, this, QVTOperationalPackage.MODEL_TYPE__ADDITIONAL_CONDITION); } return additionalCondition; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getConformanceKind() { return conformanceKind; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setConformanceKind(String newConformanceKind) { String oldConformanceKind = conformanceKind; conformanceKind = newConformanceKind; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, QVTOperationalPackage.MODEL_TYPE__CONFORMANCE_KIND, oldConformanceKind, conformanceKind)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<EPackage> getMetamodel() { if (metamodel == null) { metamodel = new EObjectResolvingEList<EPackage>(EPackage.class, this, QVTOperationalPackage.MODEL_TYPE__METAMODEL); } return metamodel; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case QVTOperationalPackage.MODEL_TYPE__ADDITIONAL_CONDITION: return ((InternalEList<?>)getAdditionalCondition()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case QVTOperationalPackage.MODEL_TYPE__ADDITIONAL_CONDITION: return getAdditionalCondition(); case QVTOperationalPackage.MODEL_TYPE__CONFORMANCE_KIND: return getConformanceKind(); case QVTOperationalPackage.MODEL_TYPE__METAMODEL: return getMetamodel(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case QVTOperationalPackage.MODEL_TYPE__ADDITIONAL_CONDITION: getAdditionalCondition().clear(); getAdditionalCondition().addAll((Collection<? extends OCLExpression>)newValue); return; case QVTOperationalPackage.MODEL_TYPE__CONFORMANCE_KIND: setConformanceKind((String)newValue); return; case QVTOperationalPackage.MODEL_TYPE__METAMODEL: getMetamodel().clear(); getMetamodel().addAll((Collection<? extends EPackage>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case QVTOperationalPackage.MODEL_TYPE__ADDITIONAL_CONDITION: getAdditionalCondition().clear(); return; case QVTOperationalPackage.MODEL_TYPE__CONFORMANCE_KIND: setConformanceKind(CONFORMANCE_KIND_EDEFAULT); return; case QVTOperationalPackage.MODEL_TYPE__METAMODEL: getMetamodel().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case QVTOperationalPackage.MODEL_TYPE__ADDITIONAL_CONDITION: return additionalCondition != null && !additionalCondition.isEmpty(); case QVTOperationalPackage.MODEL_TYPE__CONFORMANCE_KIND: return CONFORMANCE_KIND_EDEFAULT == null ? conformanceKind != null : !CONFORMANCE_KIND_EDEFAULT.equals(conformanceKind); case QVTOperationalPackage.MODEL_TYPE__METAMODEL: return metamodel != null && !metamodel.isEmpty(); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (conformanceKind: "); result.append(conformanceKind); result.append(')'); return result.toString(); } } //ModelTypeImpl