/** * Copyright (c) 2011 Stephane Begaudeau. * 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: * Stephane Begaudeau - initial API and implementation */ package com.github.sbegaudeau.acceleo.modules.psm.gen.scala.model.scala.impl; import com.github.sbegaudeau.acceleo.modules.psm.gen.scala.model.scala.Method; import com.github.sbegaudeau.acceleo.modules.psm.gen.scala.model.scala.MethodSignature; import com.github.sbegaudeau.acceleo.modules.psm.gen.scala.model.scala.ScalaPackage; import com.github.sbegaudeau.acceleo.modules.psm.gen.scala.model.scala.Visibility; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.EObjectImpl; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Method</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link com.github.sbegaudeau.acceleo.modules.psm.gen.scala.model.scala.impl.MethodImpl#getOwnedComment <em>Owned Comment</em>}</li> * <li>{@link com.github.sbegaudeau.acceleo.modules.psm.gen.scala.model.scala.impl.MethodImpl#getName <em>Name</em>}</li> * <li>{@link com.github.sbegaudeau.acceleo.modules.psm.gen.scala.model.scala.impl.MethodImpl#getSignature <em>Signature</em>}</li> * <li>{@link com.github.sbegaudeau.acceleo.modules.psm.gen.scala.model.scala.impl.MethodImpl#isIsAbstract <em>Is Abstract</em>}</li> * <li>{@link com.github.sbegaudeau.acceleo.modules.psm.gen.scala.model.scala.impl.MethodImpl#isIsFinal <em>Is Final</em>}</li> * <li>{@link com.github.sbegaudeau.acceleo.modules.psm.gen.scala.model.scala.impl.MethodImpl#isIsOverriding <em>Is Overriding</em>}</li> * <li>{@link com.github.sbegaudeau.acceleo.modules.psm.gen.scala.model.scala.impl.MethodImpl#getVisibility <em>Visibility</em>}</li> * </ul> * </p> * * @generated */ public class MethodImpl extends EObjectImpl implements Method { /** * The default value of the '{@link #getOwnedComment() <em>Owned Comment</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getOwnedComment() * @generated * @ordered */ protected static final String OWNED_COMMENT_EDEFAULT = null; /** * The cached value of the '{@link #getOwnedComment() <em>Owned Comment</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getOwnedComment() * @generated * @ordered */ protected String ownedComment = OWNED_COMMENT_EDEFAULT; /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = ""; //$NON-NLS-1$ /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getSignature() <em>Signature</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSignature() * @generated * @ordered */ protected MethodSignature signature; /** * The default value of the '{@link #isIsAbstract() <em>Is Abstract</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsAbstract() * @generated * @ordered */ protected static final boolean IS_ABSTRACT_EDEFAULT = false; /** * The cached value of the '{@link #isIsAbstract() <em>Is Abstract</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsAbstract() * @generated * @ordered */ protected boolean isAbstract = IS_ABSTRACT_EDEFAULT; /** * The default value of the '{@link #isIsFinal() <em>Is Final</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsFinal() * @generated * @ordered */ protected static final boolean IS_FINAL_EDEFAULT = false; /** * The cached value of the '{@link #isIsFinal() <em>Is Final</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsFinal() * @generated * @ordered */ protected boolean isFinal = IS_FINAL_EDEFAULT; /** * The default value of the '{@link #isIsOverriding() <em>Is Overriding</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsOverriding() * @generated * @ordered */ protected static final boolean IS_OVERRIDING_EDEFAULT = false; /** * The cached value of the '{@link #isIsOverriding() <em>Is Overriding</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isIsOverriding() * @generated * @ordered */ protected boolean isOverriding = IS_OVERRIDING_EDEFAULT; /** * The cached value of the '{@link #getVisibility() <em>Visibility</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getVisibility() * @generated * @ordered */ protected Visibility visibility; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected MethodImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return ScalaPackage.Literals.METHOD; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getOwnedComment() { return ownedComment; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setOwnedComment(String newOwnedComment) { String oldOwnedComment = ownedComment; ownedComment = newOwnedComment; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ScalaPackage.METHOD__OWNED_COMMENT, oldOwnedComment, ownedComment)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ScalaPackage.METHOD__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MethodSignature getSignature() { return signature; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetSignature(MethodSignature newSignature, NotificationChain msgs) { MethodSignature oldSignature = signature; signature = newSignature; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ScalaPackage.METHOD__SIGNATURE, oldSignature, newSignature); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSignature(MethodSignature newSignature) { if (newSignature != signature) { NotificationChain msgs = null; if (signature != null) msgs = ((InternalEObject) signature) .eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ScalaPackage.METHOD__SIGNATURE, null, msgs); if (newSignature != null) msgs = ((InternalEObject) newSignature) .eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ScalaPackage.METHOD__SIGNATURE, null, msgs); msgs = basicSetSignature(newSignature, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ScalaPackage.METHOD__SIGNATURE, newSignature, newSignature)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isIsAbstract() { return isAbstract; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIsAbstract(boolean newIsAbstract) { boolean oldIsAbstract = isAbstract; isAbstract = newIsAbstract; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ScalaPackage.METHOD__IS_ABSTRACT, oldIsAbstract, isAbstract)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isIsFinal() { return isFinal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIsFinal(boolean newIsFinal) { boolean oldIsFinal = isFinal; isFinal = newIsFinal; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ScalaPackage.METHOD__IS_FINAL, oldIsFinal, isFinal)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isIsOverriding() { return isOverriding; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIsOverriding(boolean newIsOverriding) { boolean oldIsOverriding = isOverriding; isOverriding = newIsOverriding; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ScalaPackage.METHOD__IS_OVERRIDING, oldIsOverriding, isOverriding)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Visibility getVisibility() { return visibility; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetVisibility(Visibility newVisibility, NotificationChain msgs) { Visibility oldVisibility = visibility; visibility = newVisibility; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ScalaPackage.METHOD__VISIBILITY, oldVisibility, newVisibility); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setVisibility(Visibility newVisibility) { if (newVisibility != visibility) { NotificationChain msgs = null; if (visibility != null) msgs = ((InternalEObject) visibility).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ScalaPackage.METHOD__VISIBILITY, null, msgs); if (newVisibility != null) msgs = ((InternalEObject) newVisibility).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ScalaPackage.METHOD__VISIBILITY, null, msgs); msgs = basicSetVisibility(newVisibility, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ScalaPackage.METHOD__VISIBILITY, newVisibility, newVisibility)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ScalaPackage.METHOD__SIGNATURE: return basicSetSignature(null, msgs); case ScalaPackage.METHOD__VISIBILITY: return basicSetVisibility(null, 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 ScalaPackage.METHOD__OWNED_COMMENT: return getOwnedComment(); case ScalaPackage.METHOD__NAME: return getName(); case ScalaPackage.METHOD__SIGNATURE: return getSignature(); case ScalaPackage.METHOD__IS_ABSTRACT: return isIsAbstract(); case ScalaPackage.METHOD__IS_FINAL: return isIsFinal(); case ScalaPackage.METHOD__IS_OVERRIDING: return isIsOverriding(); case ScalaPackage.METHOD__VISIBILITY: return getVisibility(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ScalaPackage.METHOD__OWNED_COMMENT: setOwnedComment((String) newValue); return; case ScalaPackage.METHOD__NAME: setName((String) newValue); return; case ScalaPackage.METHOD__SIGNATURE: setSignature((MethodSignature) newValue); return; case ScalaPackage.METHOD__IS_ABSTRACT: setIsAbstract((Boolean) newValue); return; case ScalaPackage.METHOD__IS_FINAL: setIsFinal((Boolean) newValue); return; case ScalaPackage.METHOD__IS_OVERRIDING: setIsOverriding((Boolean) newValue); return; case ScalaPackage.METHOD__VISIBILITY: setVisibility((Visibility) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ScalaPackage.METHOD__OWNED_COMMENT: setOwnedComment(OWNED_COMMENT_EDEFAULT); return; case ScalaPackage.METHOD__NAME: setName(NAME_EDEFAULT); return; case ScalaPackage.METHOD__SIGNATURE: setSignature((MethodSignature) null); return; case ScalaPackage.METHOD__IS_ABSTRACT: setIsAbstract(IS_ABSTRACT_EDEFAULT); return; case ScalaPackage.METHOD__IS_FINAL: setIsFinal(IS_FINAL_EDEFAULT); return; case ScalaPackage.METHOD__IS_OVERRIDING: setIsOverriding(IS_OVERRIDING_EDEFAULT); return; case ScalaPackage.METHOD__VISIBILITY: setVisibility((Visibility) null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ScalaPackage.METHOD__OWNED_COMMENT: return OWNED_COMMENT_EDEFAULT == null ? ownedComment != null : !OWNED_COMMENT_EDEFAULT.equals(ownedComment); case ScalaPackage.METHOD__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT .equals(name); case ScalaPackage.METHOD__SIGNATURE: return signature != null; case ScalaPackage.METHOD__IS_ABSTRACT: return isAbstract != IS_ABSTRACT_EDEFAULT; case ScalaPackage.METHOD__IS_FINAL: return isFinal != IS_FINAL_EDEFAULT; case ScalaPackage.METHOD__IS_OVERRIDING: return isOverriding != IS_OVERRIDING_EDEFAULT; case ScalaPackage.METHOD__VISIBILITY: return visibility != null; } 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(" (ownedComment: "); //$NON-NLS-1$ result.append(ownedComment); result.append(", name: "); //$NON-NLS-1$ result.append(name); result.append(", isAbstract: "); //$NON-NLS-1$ result.append(isAbstract); result.append(", isFinal: "); //$NON-NLS-1$ result.append(isFinal); result.append(", isOverriding: "); //$NON-NLS-1$ result.append(isOverriding); result.append(')'); return result.toString(); } } //MethodImpl