/*****************************************************************************
* 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.papyrus.uml.alf.alf.AlfPackage;
import org.eclipse.papyrus.uml.alf.alf.Expression;
import org.eclipse.papyrus.uml.alf.alf.PropertyCallExpression;
import org.eclipse.papyrus.uml.alf.alf.SuffixExpression;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Property Call Expression</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.PropertyCallExpressionImpl#getPropertyName <em>Property Name</em>}</li>
* <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.PropertyCallExpressionImpl#getIndex <em>Index</em>}</li>
* <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.PropertyCallExpressionImpl#getSuffix <em>Suffix</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class PropertyCallExpressionImpl extends SuffixExpressionImpl implements PropertyCallExpression
{
/**
* The default value of the '{@link #getPropertyName() <em>Property Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPropertyName()
* @generated
* @ordered
*/
protected static final String PROPERTY_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getPropertyName() <em>Property Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPropertyName()
* @generated
* @ordered
*/
protected String propertyName = PROPERTY_NAME_EDEFAULT;
/**
* The cached value of the '{@link #getIndex() <em>Index</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIndex()
* @generated
* @ordered
*/
protected Expression index;
/**
* The cached value of the '{@link #getSuffix() <em>Suffix</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSuffix()
* @generated
* @ordered
*/
protected SuffixExpression suffix;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PropertyCallExpressionImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return AlfPackage.Literals.PROPERTY_CALL_EXPRESSION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getPropertyName()
{
return propertyName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPropertyName(String newPropertyName)
{
String oldPropertyName = propertyName;
propertyName = newPropertyName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.PROPERTY_CALL_EXPRESSION__PROPERTY_NAME, oldPropertyName, propertyName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getIndex()
{
return index;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetIndex(Expression newIndex, NotificationChain msgs)
{
Expression oldIndex = index;
index = newIndex;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlfPackage.PROPERTY_CALL_EXPRESSION__INDEX, oldIndex, newIndex);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIndex(Expression newIndex)
{
if (newIndex != index)
{
NotificationChain msgs = null;
if (index != null)
msgs = ((InternalEObject)index).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlfPackage.PROPERTY_CALL_EXPRESSION__INDEX, null, msgs);
if (newIndex != null)
msgs = ((InternalEObject)newIndex).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlfPackage.PROPERTY_CALL_EXPRESSION__INDEX, null, msgs);
msgs = basicSetIndex(newIndex, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.PROPERTY_CALL_EXPRESSION__INDEX, newIndex, newIndex));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SuffixExpression getSuffix()
{
return suffix;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSuffix(SuffixExpression newSuffix, NotificationChain msgs)
{
SuffixExpression oldSuffix = suffix;
suffix = newSuffix;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlfPackage.PROPERTY_CALL_EXPRESSION__SUFFIX, oldSuffix, newSuffix);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSuffix(SuffixExpression newSuffix)
{
if (newSuffix != suffix)
{
NotificationChain msgs = null;
if (suffix != null)
msgs = ((InternalEObject)suffix).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlfPackage.PROPERTY_CALL_EXPRESSION__SUFFIX, null, msgs);
if (newSuffix != null)
msgs = ((InternalEObject)newSuffix).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlfPackage.PROPERTY_CALL_EXPRESSION__SUFFIX, null, msgs);
msgs = basicSetSuffix(newSuffix, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.PROPERTY_CALL_EXPRESSION__SUFFIX, newSuffix, newSuffix));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case AlfPackage.PROPERTY_CALL_EXPRESSION__INDEX:
return basicSetIndex(null, msgs);
case AlfPackage.PROPERTY_CALL_EXPRESSION__SUFFIX:
return basicSetSuffix(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.PROPERTY_CALL_EXPRESSION__PROPERTY_NAME:
return getPropertyName();
case AlfPackage.PROPERTY_CALL_EXPRESSION__INDEX:
return getIndex();
case AlfPackage.PROPERTY_CALL_EXPRESSION__SUFFIX:
return getSuffix();
}
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.PROPERTY_CALL_EXPRESSION__PROPERTY_NAME:
setPropertyName((String)newValue);
return;
case AlfPackage.PROPERTY_CALL_EXPRESSION__INDEX:
setIndex((Expression)newValue);
return;
case AlfPackage.PROPERTY_CALL_EXPRESSION__SUFFIX:
setSuffix((SuffixExpression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case AlfPackage.PROPERTY_CALL_EXPRESSION__PROPERTY_NAME:
setPropertyName(PROPERTY_NAME_EDEFAULT);
return;
case AlfPackage.PROPERTY_CALL_EXPRESSION__INDEX:
setIndex((Expression)null);
return;
case AlfPackage.PROPERTY_CALL_EXPRESSION__SUFFIX:
setSuffix((SuffixExpression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case AlfPackage.PROPERTY_CALL_EXPRESSION__PROPERTY_NAME:
return PROPERTY_NAME_EDEFAULT == null ? propertyName != null : !PROPERTY_NAME_EDEFAULT.equals(propertyName);
case AlfPackage.PROPERTY_CALL_EXPRESSION__INDEX:
return index != null;
case AlfPackage.PROPERTY_CALL_EXPRESSION__SUFFIX:
return suffix != 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(" (propertyName: ");
result.append(propertyName);
result.append(')');
return result.toString();
}
} //PropertyCallExpressionImpl