/******************************************************************************* * 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 *******************************************************************************/ package org.eclipse.m2m.internal.qvt.oml.expressions.impl; import java.util.Collection; 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.InternalEObject; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.m2m.internal.qvt.oml.expressions.ExpressionsPackage; import org.eclipse.m2m.internal.qvt.oml.expressions.MappingBody; import org.eclipse.ocl.ecore.OCLExpression; import org.eclipse.ocl.utilities.Visitor; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Mapping Body</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.m2m.internal.qvt.oml.expressions.impl.MappingBodyImpl#getEndSection <em>End Section</em>}</li> * <li>{@link org.eclipse.m2m.internal.qvt.oml.expressions.impl.MappingBodyImpl#getInitSection <em>Init Section</em>}</li> * </ul> * </p> * * @generated */ public class MappingBodyImpl extends OperationBodyImpl implements MappingBody { /** * <!-- 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$ /** * The cached value of the '{@link #getEndSection() <em>End Section</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEndSection() * @generated * @ordered */ protected EList<OCLExpression> endSection; /** * The cached value of the '{@link #getInitSection() <em>Init Section</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getInitSection() * @generated * @ordered */ protected EList<OCLExpression> initSection; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected MappingBodyImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return ExpressionsPackage.Literals.MAPPING_BODY; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<OCLExpression> getInitSection() { if (initSection == null) { initSection = new EObjectContainmentEList<OCLExpression>(OCLExpression.class, this, ExpressionsPackage.MAPPING_BODY__INIT_SECTION); } return initSection; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<OCLExpression> getEndSection() { if (endSection == null) { endSection = new EObjectContainmentEList<OCLExpression>(OCLExpression.class, this, ExpressionsPackage.MAPPING_BODY__END_SECTION); } return endSection; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public <T, U extends Visitor<T, ?, ?, ?, ?, ?, ?, ?, ?, ?>> T accept(U v) { if(v instanceof org.eclipse.m2m.internal.qvt.oml.expressions.util.QVTOperationalVisitor) { @SuppressWarnings("unchecked") org.eclipse.m2m.internal.qvt.oml.expressions.util.QVTOperationalVisitor<T> visitorExt = (org.eclipse.m2m.internal.qvt.oml.expressions.util.QVTOperationalVisitor) v; return visitorExt.visitMappingBody(this); } return org.eclipse.m2m.internal.qvt.oml.expressions.util.ForeignVisitorDefaultValue.getDefaultValueForVisitor(v); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ExpressionsPackage.MAPPING_BODY__END_SECTION: return ((InternalEList<?>)getEndSection()).basicRemove(otherEnd, msgs); case ExpressionsPackage.MAPPING_BODY__INIT_SECTION: return ((InternalEList<?>)getInitSection()).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 ExpressionsPackage.MAPPING_BODY__END_SECTION: return getEndSection(); case ExpressionsPackage.MAPPING_BODY__INIT_SECTION: return getInitSection(); } 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 ExpressionsPackage.MAPPING_BODY__END_SECTION: getEndSection().clear(); getEndSection().addAll((Collection<? extends OCLExpression>)newValue); return; case ExpressionsPackage.MAPPING_BODY__INIT_SECTION: getInitSection().clear(); getInitSection().addAll((Collection<? extends OCLExpression>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ExpressionsPackage.MAPPING_BODY__END_SECTION: getEndSection().clear(); return; case ExpressionsPackage.MAPPING_BODY__INIT_SECTION: getInitSection().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ExpressionsPackage.MAPPING_BODY__END_SECTION: return endSection != null && !endSection.isEmpty(); case ExpressionsPackage.MAPPING_BODY__INIT_SECTION: return initSection != null && !initSection.isEmpty(); } return super.eIsSet(featureID); } } //MappingBodyImpl