blob: c97843c8100ab632c81f72e48e1ef8de0c719f17 [file] [log] [blame]
/**
* *******************************************************************************
* 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:
*
* Fabien Giquel (Mia-Software) - initial API and implementation
* Gregoire DUPE (Mia-Software) - initial API and implementation
* *******************************************************************************
*
* $Id$
*/
package org.eclipse.gmt.modisco.java.nousages.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.Expression;
import org.eclipse.gmt.modisco.java.InstanceofExpression;
import org.eclipse.gmt.modisco.java.TypeAccess;
import org.eclipse.gmt.modisco.java.nousages.meta.JavaPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Instanceof Expression</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.gmt.modisco.java.nousages.impl.InstanceofExpressionImpl#getRightOperand <em>Right Operand</em>}</li>
* <li>{@link org.eclipse.gmt.modisco.java.nousages.impl.InstanceofExpressionImpl#getLeftOperand <em>Left Operand</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class InstanceofExpressionImpl extends ExpressionImpl implements InstanceofExpression {
/**
* The cached value of the '{@link #getRightOperand() <em>Right Operand</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRightOperand()
* @generated
* @ordered
*/
protected TypeAccess rightOperand;
/**
* The cached value of the '{@link #getLeftOperand() <em>Left Operand</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLeftOperand()
* @generated
* @ordered
*/
protected Expression leftOperand;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected InstanceofExpressionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return JavaPackage.eINSTANCE.getInstanceofExpression();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TypeAccess getRightOperand() {
return rightOperand;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetRightOperand(TypeAccess newRightOperand, NotificationChain msgs) {
TypeAccess oldRightOperand = rightOperand;
rightOperand = newRightOperand;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaPackage.INSTANCEOF_EXPRESSION__RIGHT_OPERAND, oldRightOperand, newRightOperand);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRightOperand(TypeAccess newRightOperand) {
if (newRightOperand != rightOperand) {
NotificationChain msgs = null;
if (rightOperand != null)
msgs = ((InternalEObject)rightOperand).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JavaPackage.INSTANCEOF_EXPRESSION__RIGHT_OPERAND, null, msgs);
if (newRightOperand != null)
msgs = ((InternalEObject)newRightOperand).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JavaPackage.INSTANCEOF_EXPRESSION__RIGHT_OPERAND, null, msgs);
msgs = basicSetRightOperand(newRightOperand, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.INSTANCEOF_EXPRESSION__RIGHT_OPERAND, newRightOperand, newRightOperand));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getLeftOperand() {
return leftOperand;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLeftOperand(Expression newLeftOperand, NotificationChain msgs) {
Expression oldLeftOperand = leftOperand;
leftOperand = newLeftOperand;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaPackage.INSTANCEOF_EXPRESSION__LEFT_OPERAND, oldLeftOperand, newLeftOperand);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLeftOperand(Expression newLeftOperand) {
if (newLeftOperand != leftOperand) {
NotificationChain msgs = null;
if (leftOperand != null)
msgs = ((InternalEObject)leftOperand).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JavaPackage.INSTANCEOF_EXPRESSION__LEFT_OPERAND, null, msgs);
if (newLeftOperand != null)
msgs = ((InternalEObject)newLeftOperand).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JavaPackage.INSTANCEOF_EXPRESSION__LEFT_OPERAND, null, msgs);
msgs = basicSetLeftOperand(newLeftOperand, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.INSTANCEOF_EXPRESSION__LEFT_OPERAND, newLeftOperand, newLeftOperand));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case JavaPackage.INSTANCEOF_EXPRESSION__RIGHT_OPERAND:
return basicSetRightOperand(null, msgs);
case JavaPackage.INSTANCEOF_EXPRESSION__LEFT_OPERAND:
return basicSetLeftOperand(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.INSTANCEOF_EXPRESSION__RIGHT_OPERAND:
return getRightOperand();
case JavaPackage.INSTANCEOF_EXPRESSION__LEFT_OPERAND:
return getLeftOperand();
}
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.INSTANCEOF_EXPRESSION__RIGHT_OPERAND:
setRightOperand((TypeAccess)newValue);
return;
case JavaPackage.INSTANCEOF_EXPRESSION__LEFT_OPERAND:
setLeftOperand((Expression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case JavaPackage.INSTANCEOF_EXPRESSION__RIGHT_OPERAND:
setRightOperand((TypeAccess)null);
return;
case JavaPackage.INSTANCEOF_EXPRESSION__LEFT_OPERAND:
setLeftOperand((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case JavaPackage.INSTANCEOF_EXPRESSION__RIGHT_OPERAND:
return rightOperand != null;
case JavaPackage.INSTANCEOF_EXPRESSION__LEFT_OPERAND:
return leftOperand != null;
}
return super.eIsSet(featureID);
}
} //InstanceofExpressionImpl