/** | |
* ******************************************************************************* | |
* Copyright (c) 2009 Mia-Software. | |
* 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: | |
* | |
* Sebastien Minguet (Mia-Software) - initial API and implementation | |
* Frederic Madiot (Mia-Software) - initial API and implementation | |
* Fabien Giquel (Mia-Software) - initial API and implementation | |
* Gabriel Barbier (Mia-Software) - initial API and implementation | |
* Erwan Breton (Sodifrance) - initial API and implementation | |
* Romain Dervaux (Mia-Software) - initial API and implementation | |
* ******************************************************************************* | |
* | |
* $Id$ | |
*/ | |
package org.eclipse.gmt.modisco.java.emf.impl; | |
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.gmt.modisco.java.TypeAccess; | |
import org.eclipse.gmt.modisco.java.WildCardType; | |
import org.eclipse.gmt.modisco.java.emf.JavaPackage; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Wild Card Type</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.gmt.modisco.java.emf.impl.WildCardTypeImpl#isUpperBound <em>Upper Bound</em>}</li> | |
* <li>{@link org.eclipse.gmt.modisco.java.emf.impl.WildCardTypeImpl#getBound <em>Bound</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class WildCardTypeImpl extends TypeImpl implements WildCardType { | |
/** | |
* The default value of the '{@link #isUpperBound() <em>Upper Bound</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #isUpperBound() | |
* @generated | |
* @ordered | |
*/ | |
protected static final boolean UPPER_BOUND_EDEFAULT = false; | |
/** | |
* The cached value of the '{@link #isUpperBound() <em>Upper Bound</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #isUpperBound() | |
* @generated | |
* @ordered | |
*/ | |
protected boolean upperBound = UPPER_BOUND_EDEFAULT; | |
/** | |
* The cached value of the '{@link #getBound() <em>Bound</em>}' containment reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getBound() | |
* @generated | |
* @ordered | |
*/ | |
protected TypeAccess bound; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected WildCardTypeImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return JavaPackage.eINSTANCE.getWildCardType(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public boolean isUpperBound() { | |
return upperBound; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setUpperBound(boolean newUpperBound) { | |
boolean oldUpperBound = upperBound; | |
upperBound = newUpperBound; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.WILD_CARD_TYPE__UPPER_BOUND, oldUpperBound, upperBound)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public TypeAccess getBound() { | |
return bound; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NotificationChain basicSetBound(TypeAccess newBound, NotificationChain msgs) { | |
TypeAccess oldBound = bound; | |
bound = newBound; | |
if (eNotificationRequired()) { | |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaPackage.WILD_CARD_TYPE__BOUND, oldBound, newBound); | |
if (msgs == null) msgs = notification; else msgs.add(notification); | |
} | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setBound(TypeAccess newBound) { | |
if (newBound != bound) { | |
NotificationChain msgs = null; | |
if (bound != null) | |
msgs = ((InternalEObject)bound).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JavaPackage.WILD_CARD_TYPE__BOUND, null, msgs); | |
if (newBound != null) | |
msgs = ((InternalEObject)newBound).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JavaPackage.WILD_CARD_TYPE__BOUND, null, msgs); | |
msgs = basicSetBound(newBound, msgs); | |
if (msgs != null) msgs.dispatch(); | |
} | |
else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.WILD_CARD_TYPE__BOUND, newBound, newBound)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case JavaPackage.WILD_CARD_TYPE__BOUND: | |
return basicSetBound(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 JavaPackage.WILD_CARD_TYPE__UPPER_BOUND: | |
return isUpperBound(); | |
case JavaPackage.WILD_CARD_TYPE__BOUND: | |
return getBound(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case JavaPackage.WILD_CARD_TYPE__UPPER_BOUND: | |
setUpperBound((Boolean)newValue); | |
return; | |
case JavaPackage.WILD_CARD_TYPE__BOUND: | |
setBound((TypeAccess)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case JavaPackage.WILD_CARD_TYPE__UPPER_BOUND: | |
setUpperBound(UPPER_BOUND_EDEFAULT); | |
return; | |
case JavaPackage.WILD_CARD_TYPE__BOUND: | |
setBound((TypeAccess)null); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case JavaPackage.WILD_CARD_TYPE__UPPER_BOUND: | |
return upperBound != UPPER_BOUND_EDEFAULT; | |
case JavaPackage.WILD_CARD_TYPE__BOUND: | |
return bound != 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(" (upperBound: "); | |
result.append(upperBound); | |
result.append(')'); | |
return result.toString(); | |
} | |
} //WildCardTypeImpl |