/**
*/
package de.gebit.integrity.dsl.impl;
import de.gebit.integrity.dsl.DslPackage;
import de.gebit.integrity.dsl.Variable;
import de.gebit.integrity.dsl.VariableOrConstantEntity;
import org.eclipse.emf.common.notify.Notification;
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</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link de.gebit.integrity.dsl.impl.VariableImpl#getName <em>Name</em>}</li>
* <li>{@link de.gebit.integrity.dsl.impl.VariableImpl#getAttribute <em>Attribute</em>}</li>
* </ul>
*
* @generated
*/
public class VariableImpl extends ValueImpl implements Variable
{
/**
* The cached value of the '{@link #getName() <em>Name</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected VariableOrConstantEntity name;
/**
* The default value of the '{@link #getAttribute() <em>Attribute</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAttribute()
* @generated
* @ordered
*/
protected static final String ATTRIBUTE_EDEFAULT = null;
/**
* The cached value of the '{@link #getAttribute() <em>Attribute</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAttribute()
* @generated
* @ordered
*/
protected String attribute = ATTRIBUTE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected VariableImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return DslPackage.Literals.VARIABLE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public VariableOrConstantEntity getName()
{
if (name != null && name.eIsProxy())
{
InternalEObject oldName = (InternalEObject)name;
name = (VariableOrConstantEntity)eResolveProxy(oldName);
if (name != oldName)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, DslPackage.VARIABLE__NAME, oldName, name));
}
}
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public VariableOrConstantEntity basicGetName()
{
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(VariableOrConstantEntity newName)
{
VariableOrConstantEntity oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.VARIABLE__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getAttribute()
{
return attribute;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAttribute(String newAttribute)
{
String oldAttribute = attribute;
attribute = newAttribute;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.VARIABLE__ATTRIBUTE, oldAttribute, attribute));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case DslPackage.VARIABLE__NAME:
if (resolve) return getName();
return basicGetName();
case DslPackage.VARIABLE__ATTRIBUTE:
return getAttribute();
}
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__NAME:
setName((VariableOrConstantEntity)newValue);
return;
case DslPackage.VARIABLE__ATTRIBUTE:
setAttribute((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case DslPackage.VARIABLE__NAME:
setName((VariableOrConstantEntity)null);
return;
case DslPackage.VARIABLE__ATTRIBUTE:
setAttribute(ATTRIBUTE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case DslPackage.VARIABLE__NAME:
return name != null;
case DslPackage.VARIABLE__ATTRIBUTE:
return ATTRIBUTE_EDEFAULT == null ? attribute != null : !ATTRIBUTE_EDEFAULT.equals(attribute);
}
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(" (attribute: ");
result.append(attribute);
result.append(')');
return result.toString();
}
} //VariableImpl