/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
*
*
* 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:
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.alf.alf.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.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.papyrus.uml.alf.alf.AlfPackage;
import org.eclipse.papyrus.uml.alf.alf.Expression;
import org.eclipse.papyrus.uml.alf.alf.LoopVariableDefinition;
import org.eclipse.papyrus.uml.alf.alf.QualifiedNameWithBinding;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Loop Variable Definition</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.LoopVariableDefinitionImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.LoopVariableDefinitionImpl#getExpression1 <em>Expression1</em>}</li>
* <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.LoopVariableDefinitionImpl#getExpression2 <em>Expression2</em>}</li>
* <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.LoopVariableDefinitionImpl#getType <em>Type</em>}</li>
* <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.LoopVariableDefinitionImpl#getExpression <em>Expression</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class LoopVariableDefinitionImpl extends MinimalEObjectImpl.Container implements LoopVariableDefinition
{
/**
* 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 = null;
/**
* 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 #getExpression1() <em>Expression1</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExpression1()
* @generated
* @ordered
*/
protected Expression expression1;
/**
* The cached value of the '{@link #getExpression2() <em>Expression2</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExpression2()
* @generated
* @ordered
*/
protected Expression expression2;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected QualifiedNameWithBinding type;
/**
* The cached value of the '{@link #getExpression() <em>Expression</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExpression()
* @generated
* @ordered
*/
protected Expression expression;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LoopVariableDefinitionImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return AlfPackage.Literals.LOOP_VARIABLE_DEFINITION;
}
/**
* <!-- 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, AlfPackage.LOOP_VARIABLE_DEFINITION__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getExpression1()
{
return expression1;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExpression1(Expression newExpression1, NotificationChain msgs)
{
Expression oldExpression1 = expression1;
expression1 = newExpression1;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION1, oldExpression1, newExpression1);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setExpression1(Expression newExpression1)
{
if (newExpression1 != expression1)
{
NotificationChain msgs = null;
if (expression1 != null)
msgs = ((InternalEObject)expression1).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION1, null, msgs);
if (newExpression1 != null)
msgs = ((InternalEObject)newExpression1).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION1, null, msgs);
msgs = basicSetExpression1(newExpression1, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION1, newExpression1, newExpression1));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getExpression2()
{
return expression2;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExpression2(Expression newExpression2, NotificationChain msgs)
{
Expression oldExpression2 = expression2;
expression2 = newExpression2;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION2, oldExpression2, newExpression2);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setExpression2(Expression newExpression2)
{
if (newExpression2 != expression2)
{
NotificationChain msgs = null;
if (expression2 != null)
msgs = ((InternalEObject)expression2).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION2, null, msgs);
if (newExpression2 != null)
msgs = ((InternalEObject)newExpression2).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION2, null, msgs);
msgs = basicSetExpression2(newExpression2, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION2, newExpression2, newExpression2));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public QualifiedNameWithBinding getType()
{
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetType(QualifiedNameWithBinding newType, NotificationChain msgs)
{
QualifiedNameWithBinding oldType = type;
type = newType;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlfPackage.LOOP_VARIABLE_DEFINITION__TYPE, oldType, newType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(QualifiedNameWithBinding newType)
{
if (newType != type)
{
NotificationChain msgs = null;
if (type != null)
msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlfPackage.LOOP_VARIABLE_DEFINITION__TYPE, null, msgs);
if (newType != null)
msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlfPackage.LOOP_VARIABLE_DEFINITION__TYPE, null, msgs);
msgs = basicSetType(newType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.LOOP_VARIABLE_DEFINITION__TYPE, newType, newType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getExpression()
{
return expression;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExpression(Expression newExpression, NotificationChain msgs)
{
Expression oldExpression = expression;
expression = newExpression;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION, oldExpression, newExpression);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setExpression(Expression newExpression)
{
if (newExpression != expression)
{
NotificationChain msgs = null;
if (expression != null)
msgs = ((InternalEObject)expression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION, null, msgs);
if (newExpression != null)
msgs = ((InternalEObject)newExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION, null, msgs);
msgs = basicSetExpression(newExpression, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION, newExpression, newExpression));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION1:
return basicSetExpression1(null, msgs);
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION2:
return basicSetExpression2(null, msgs);
case AlfPackage.LOOP_VARIABLE_DEFINITION__TYPE:
return basicSetType(null, msgs);
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION:
return basicSetExpression(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 AlfPackage.LOOP_VARIABLE_DEFINITION__NAME:
return getName();
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION1:
return getExpression1();
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION2:
return getExpression2();
case AlfPackage.LOOP_VARIABLE_DEFINITION__TYPE:
return getType();
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION:
return getExpression();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case AlfPackage.LOOP_VARIABLE_DEFINITION__NAME:
setName((String)newValue);
return;
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION1:
setExpression1((Expression)newValue);
return;
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION2:
setExpression2((Expression)newValue);
return;
case AlfPackage.LOOP_VARIABLE_DEFINITION__TYPE:
setType((QualifiedNameWithBinding)newValue);
return;
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION:
setExpression((Expression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case AlfPackage.LOOP_VARIABLE_DEFINITION__NAME:
setName(NAME_EDEFAULT);
return;
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION1:
setExpression1((Expression)null);
return;
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION2:
setExpression2((Expression)null);
return;
case AlfPackage.LOOP_VARIABLE_DEFINITION__TYPE:
setType((QualifiedNameWithBinding)null);
return;
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION:
setExpression((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case AlfPackage.LOOP_VARIABLE_DEFINITION__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION1:
return expression1 != null;
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION2:
return expression2 != null;
case AlfPackage.LOOP_VARIABLE_DEFINITION__TYPE:
return type != null;
case AlfPackage.LOOP_VARIABLE_DEFINITION__EXPRESSION:
return expression != 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(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //LoopVariableDefinitionImpl