/**
*/
package activitydiagram.impl;
import activitydiagram.ActivitydiagramPackage;
import activitydiagram.Value;
import activitydiagram.Variable;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Variable</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link activitydiagram.impl.VariableImpl#getInitialValue <em>Initial Value</em>}</li>
* <li>{@link activitydiagram.impl.VariableImpl#getName <em>Name</em>}</li>
* <li>{@link activitydiagram.impl.VariableImpl#getCurrentValue <em>Current Value</em>}</li>
* </ul>
*
* @generated
*/
public abstract class VariableImpl extends MinimalEObjectImpl.Container implements Variable {
/**
* The cached value of the '{@link #getInitialValue() <em>Initial Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInitialValue()
* @generated
* @ordered
*/
protected Value initialValue;
/**
* 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 #getCurrentValue() <em>Current Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCurrentValue()
* @generated
* @ordered
*/
protected Value currentValue;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected VariableImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ActivitydiagramPackage.Literals.VARIABLE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Value getInitialValue() {
return initialValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetInitialValue(Value newInitialValue, NotificationChain msgs) {
Value oldInitialValue = initialValue;
initialValue = newInitialValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ActivitydiagramPackage.VARIABLE__INITIAL_VALUE, oldInitialValue, newInitialValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setInitialValue(Value newInitialValue) {
if (newInitialValue != initialValue) {
NotificationChain msgs = null;
if (initialValue != null)
msgs = ((InternalEObject)initialValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ActivitydiagramPackage.VARIABLE__INITIAL_VALUE, null, msgs);
if (newInitialValue != null)
msgs = ((InternalEObject)newInitialValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ActivitydiagramPackage.VARIABLE__INITIAL_VALUE, null, msgs);
msgs = basicSetInitialValue(newInitialValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ActivitydiagramPackage.VARIABLE__INITIAL_VALUE, newInitialValue, newInitialValue));
}
/**
* <!-- 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, ActivitydiagramPackage.VARIABLE__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Value getCurrentValue() {
return currentValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetCurrentValue(Value newCurrentValue, NotificationChain msgs) {
Value oldCurrentValue = currentValue;
currentValue = newCurrentValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ActivitydiagramPackage.VARIABLE__CURRENT_VALUE, oldCurrentValue, newCurrentValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCurrentValue(Value newCurrentValue) {
if (newCurrentValue != currentValue) {
NotificationChain msgs = null;
if (currentValue != null)
msgs = ((InternalEObject)currentValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ActivitydiagramPackage.VARIABLE__CURRENT_VALUE, null, msgs);
if (newCurrentValue != null)
msgs = ((InternalEObject)newCurrentValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ActivitydiagramPackage.VARIABLE__CURRENT_VALUE, null, msgs);
msgs = basicSetCurrentValue(newCurrentValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ActivitydiagramPackage.VARIABLE__CURRENT_VALUE, newCurrentValue, newCurrentValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ActivitydiagramPackage.VARIABLE__INITIAL_VALUE:
return basicSetInitialValue(null, msgs);
case ActivitydiagramPackage.VARIABLE__CURRENT_VALUE:
return basicSetCurrentValue(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 ActivitydiagramPackage.VARIABLE__INITIAL_VALUE:
return getInitialValue();
case ActivitydiagramPackage.VARIABLE__NAME:
return getName();
case ActivitydiagramPackage.VARIABLE__CURRENT_VALUE:
return getCurrentValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ActivitydiagramPackage.VARIABLE__INITIAL_VALUE:
setInitialValue((Value)newValue);
return;
case ActivitydiagramPackage.VARIABLE__NAME:
setName((String)newValue);
return;
case ActivitydiagramPackage.VARIABLE__CURRENT_VALUE:
setCurrentValue((Value)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ActivitydiagramPackage.VARIABLE__INITIAL_VALUE:
setInitialValue((Value)null);
return;
case ActivitydiagramPackage.VARIABLE__NAME:
setName(NAME_EDEFAULT);
return;
case ActivitydiagramPackage.VARIABLE__CURRENT_VALUE:
setCurrentValue((Value)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ActivitydiagramPackage.VARIABLE__INITIAL_VALUE:
return initialValue != null;
case ActivitydiagramPackage.VARIABLE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case ActivitydiagramPackage.VARIABLE__CURRENT_VALUE:
return currentValue != 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();
}
} //VariableImpl