/**
*/
package de.gebit.integrity.dsl.impl;
import de.gebit.integrity.dsl.DslPackage;
import de.gebit.integrity.dsl.ValueOrEnumValueOrOperationCollection;
import de.gebit.integrity.dsl.VariableDefinition;
import de.gebit.integrity.dsl.VariableEntity;
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>Variable Definition</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link de.gebit.integrity.dsl.impl.VariableDefinitionImpl#getPrivate <em>Private</em>}</li>
* <li>{@link de.gebit.integrity.dsl.impl.VariableDefinitionImpl#getName <em>Name</em>}</li>
* <li>{@link de.gebit.integrity.dsl.impl.VariableDefinitionImpl#getInitialValue <em>Initial Value</em>}</li>
* </ul>
*
* @generated
*/
public class VariableDefinitionImpl extends PackageStatementImpl implements VariableDefinition
{
/**
* The default value of the '{@link #getPrivate() <em>Private</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPrivate()
* @generated
* @ordered
*/
protected static final String PRIVATE_EDEFAULT = null;
/**
* The cached value of the '{@link #getPrivate() <em>Private</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPrivate()
* @generated
* @ordered
*/
protected String private_ = PRIVATE_EDEFAULT;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected VariableEntity name;
/**
* The cached value of the '{@link #getInitialValue() <em>Initial Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInitialValue()
* @generated
* @ordered
*/
protected ValueOrEnumValueOrOperationCollection initialValue;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected VariableDefinitionImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return DslPackage.Literals.VARIABLE_DEFINITION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getPrivate()
{
return private_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPrivate(String newPrivate)
{
String oldPrivate = private_;
private_ = newPrivate;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.VARIABLE_DEFINITION__PRIVATE, oldPrivate, private_));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public VariableEntity getName()
{
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetName(VariableEntity newName, NotificationChain msgs)
{
VariableEntity oldName = name;
name = newName;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DslPackage.VARIABLE_DEFINITION__NAME, oldName, newName);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(VariableEntity newName)
{
if (newName != name)
{
NotificationChain msgs = null;
if (name != null)
msgs = ((InternalEObject)name).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DslPackage.VARIABLE_DEFINITION__NAME, null, msgs);
if (newName != null)
msgs = ((InternalEObject)newName).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DslPackage.VARIABLE_DEFINITION__NAME, null, msgs);
msgs = basicSetName(newName, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.VARIABLE_DEFINITION__NAME, newName, newName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ValueOrEnumValueOrOperationCollection getInitialValue()
{
return initialValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetInitialValue(ValueOrEnumValueOrOperationCollection newInitialValue, NotificationChain msgs)
{
ValueOrEnumValueOrOperationCollection oldInitialValue = initialValue;
initialValue = newInitialValue;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DslPackage.VARIABLE_DEFINITION__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(ValueOrEnumValueOrOperationCollection newInitialValue)
{
if (newInitialValue != initialValue)
{
NotificationChain msgs = null;
if (initialValue != null)
msgs = ((InternalEObject)initialValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DslPackage.VARIABLE_DEFINITION__INITIAL_VALUE, null, msgs);
if (newInitialValue != null)
msgs = ((InternalEObject)newInitialValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DslPackage.VARIABLE_DEFINITION__INITIAL_VALUE, null, msgs);
msgs = basicSetInitialValue(newInitialValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.VARIABLE_DEFINITION__INITIAL_VALUE, newInitialValue, newInitialValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case DslPackage.VARIABLE_DEFINITION__NAME:
return basicSetName(null, msgs);
case DslPackage.VARIABLE_DEFINITION__INITIAL_VALUE:
return basicSetInitialValue(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 DslPackage.VARIABLE_DEFINITION__PRIVATE:
return getPrivate();
case DslPackage.VARIABLE_DEFINITION__NAME:
return getName();
case DslPackage.VARIABLE_DEFINITION__INITIAL_VALUE:
return getInitialValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case DslPackage.VARIABLE_DEFINITION__PRIVATE:
setPrivate((String)newValue);
return;
case DslPackage.VARIABLE_DEFINITION__NAME:
setName((VariableEntity)newValue);
return;
case DslPackage.VARIABLE_DEFINITION__INITIAL_VALUE:
setInitialValue((ValueOrEnumValueOrOperationCollection)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case DslPackage.VARIABLE_DEFINITION__PRIVATE:
setPrivate(PRIVATE_EDEFAULT);
return;
case DslPackage.VARIABLE_DEFINITION__NAME:
setName((VariableEntity)null);
return;
case DslPackage.VARIABLE_DEFINITION__INITIAL_VALUE:
setInitialValue((ValueOrEnumValueOrOperationCollection)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case DslPackage.VARIABLE_DEFINITION__PRIVATE:
return PRIVATE_EDEFAULT == null ? private_ != null : !PRIVATE_EDEFAULT.equals(private_);
case DslPackage.VARIABLE_DEFINITION__NAME:
return name != null;
case DslPackage.VARIABLE_DEFINITION__INITIAL_VALUE:
return initialValue != 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(" (private: ");
result.append(private_);
result.append(')');
return result.toString();
}
} //VariableDefinitionImpl