/**
* Copyright (c) 2013 Puppet Labs, Inc. and other contributors, as listed below.
* 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:
* Puppet Labs
*/
package com.puppetlabs.geppetto.pp.impl;
import com.puppetlabs.geppetto.pp.Expression;
import com.puppetlabs.geppetto.pp.PPPackage;
import com.puppetlabs.geppetto.pp.ParenthesisedExpression;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Parenthesised Expression</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link com.puppetlabs.geppetto.pp.impl.ParenthesisedExpressionImpl#getExpr <em>Expr</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ParenthesisedExpressionImpl extends ExpressionImpl implements ParenthesisedExpression {
/**
* The cached value of the '{@link #getExpr() <em>Expr</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getExpr()
* @generated
* @ordered
*/
protected Expression expr;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected ParenthesisedExpressionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetExpr(Expression newExpr, NotificationChain msgs) {
Expression oldExpr = expr;
expr = newExpr;
if(eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(
this, Notification.SET, PPPackage.PARENTHESISED_EXPRESSION__EXPR, oldExpr, newExpr);
if(msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch(featureID) {
case PPPackage.PARENTHESISED_EXPRESSION__EXPR:
return getExpr();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch(featureID) {
case PPPackage.PARENTHESISED_EXPRESSION__EXPR:
return basicSetExpr(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch(featureID) {
case PPPackage.PARENTHESISED_EXPRESSION__EXPR:
return expr != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch(featureID) {
case PPPackage.PARENTHESISED_EXPRESSION__EXPR:
setExpr((Expression) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return PPPackage.Literals.PARENTHESISED_EXPRESSION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch(featureID) {
case PPPackage.PARENTHESISED_EXPRESSION__EXPR:
setExpr((Expression) null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public Expression getExpr() {
return expr;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public void setExpr(Expression newExpr) {
if(newExpr != expr) {
NotificationChain msgs = null;
if(expr != null)
msgs = ((InternalEObject) expr).eInverseRemove(this, EOPPOSITE_FEATURE_BASE -
PPPackage.PARENTHESISED_EXPRESSION__EXPR, null, msgs);
if(newExpr != null)
msgs = ((InternalEObject) newExpr).eInverseAdd(this, EOPPOSITE_FEATURE_BASE -
PPPackage.PARENTHESISED_EXPRESSION__EXPR, null, msgs);
msgs = basicSetExpr(newExpr, msgs);
if(msgs != null)
msgs.dispatch();
}
else if(eNotificationRequired())
eNotify(new ENotificationImpl(
this, Notification.SET, PPPackage.PARENTHESISED_EXPRESSION__EXPR, newExpr, newExpr));
}
} // ParenthesisedExpressionImpl