/**
*/
package org.erlide.erlang.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.erlide.erlang.BinUnitType;
import org.erlide.erlang.ErlangPackage;
import org.erlide.erlang.Expression;
import org.erlide.erlang.Type;
/**
* <!-- begin-user-doc --> An implementation of the model object '
* <em><b>Bin Unit Type</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.erlide.erlang.impl.BinUnitTypeImpl#getTypeName <em>Type Name
* </em>}</li>
* <li>{@link org.erlide.erlang.impl.BinUnitTypeImpl#getM <em>M</em>}</li>
* <li>{@link org.erlide.erlang.impl.BinUnitTypeImpl#getType <em>Type</em>}</li>
* </ul>
*
* @generated
*/
public class BinUnitTypeImpl extends MinimalEObjectImpl.Container implements
BinUnitType {
/**
* The cached value of the '{@link #getTypeName() <em>Type Name</em>}'
* containment reference. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getTypeName()
* @generated
* @ordered
*/
protected Expression typeName;
/**
* The default value of the '{@link #getM() <em>M</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #getM()
* @generated
* @ordered
*/
protected static final String M_EDEFAULT = null;
/**
* The cached value of the '{@link #getM() <em>M</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #getM()
* @generated
* @ordered
*/
protected String m = M_EDEFAULT;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' containment
* reference. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getType()
* @generated
* @ordered
*/
protected Type type;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected BinUnitTypeImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ErlangPackage.Literals.BIN_UNIT_TYPE;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public Expression getTypeName() {
return typeName;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetTypeName(final Expression newTypeName,
NotificationChain msgs) {
final Expression oldTypeName = typeName;
typeName = newTypeName;
if (eNotificationRequired()) {
final ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, ErlangPackage.BIN_UNIT_TYPE__TYPE_NAME,
oldTypeName, newTypeName);
if (msgs == null) {
msgs = notification;
} else {
msgs.add(notification);
}
}
return msgs;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setTypeName(final Expression newTypeName) {
if (newTypeName != typeName) {
NotificationChain msgs = null;
if (typeName != null) {
msgs = ((InternalEObject) typeName).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE
- ErlangPackage.BIN_UNIT_TYPE__TYPE_NAME, null,
msgs);
}
if (newTypeName != null) {
msgs = ((InternalEObject) newTypeName).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE
- ErlangPackage.BIN_UNIT_TYPE__TYPE_NAME, null,
msgs);
}
msgs = basicSetTypeName(newTypeName, msgs);
if (msgs != null) {
msgs.dispatch();
}
} else if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET,
ErlangPackage.BIN_UNIT_TYPE__TYPE_NAME, newTypeName,
newTypeName));
}
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public String getM() {
return m;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setM(final String newM) {
final String oldM = m;
m = newM;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET,
ErlangPackage.BIN_UNIT_TYPE__M, oldM, m));
}
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public Type getType() {
return type;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetType(final Type newType,
NotificationChain msgs) {
final Type oldType = type;
type = newType;
if (eNotificationRequired()) {
final ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, ErlangPackage.BIN_UNIT_TYPE__TYPE,
oldType, newType);
if (msgs == null) {
msgs = notification;
} else {
msgs.add(notification);
}
}
return msgs;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setType(final Type newType) {
if (newType != type) {
NotificationChain msgs = null;
if (type != null) {
msgs = ((InternalEObject) type)
.eInverseRemove(this, EOPPOSITE_FEATURE_BASE
- ErlangPackage.BIN_UNIT_TYPE__TYPE, null, msgs);
}
if (newType != null) {
msgs = ((InternalEObject) newType)
.eInverseAdd(this, EOPPOSITE_FEATURE_BASE
- ErlangPackage.BIN_UNIT_TYPE__TYPE, null, msgs);
}
msgs = basicSetType(newType, msgs);
if (msgs != null) {
msgs.dispatch();
}
} else if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET,
ErlangPackage.BIN_UNIT_TYPE__TYPE, newType, newType));
}
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(final InternalEObject otherEnd,
final int featureID, final NotificationChain msgs) {
switch (featureID) {
case ErlangPackage.BIN_UNIT_TYPE__TYPE_NAME:
return basicSetTypeName(null, msgs);
case ErlangPackage.BIN_UNIT_TYPE__TYPE:
return basicSetType(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public Object eGet(final int featureID, final boolean resolve,
final boolean coreType) {
switch (featureID) {
case ErlangPackage.BIN_UNIT_TYPE__TYPE_NAME:
return getTypeName();
case ErlangPackage.BIN_UNIT_TYPE__M:
return getM();
case ErlangPackage.BIN_UNIT_TYPE__TYPE:
return getType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eSet(final int featureID, final Object newValue) {
switch (featureID) {
case ErlangPackage.BIN_UNIT_TYPE__TYPE_NAME:
setTypeName((Expression) newValue);
return;
case ErlangPackage.BIN_UNIT_TYPE__M:
setM((String) newValue);
return;
case ErlangPackage.BIN_UNIT_TYPE__TYPE:
setType((Type) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(final int featureID) {
switch (featureID) {
case ErlangPackage.BIN_UNIT_TYPE__TYPE_NAME:
setTypeName((Expression) null);
return;
case ErlangPackage.BIN_UNIT_TYPE__M:
setM(M_EDEFAULT);
return;
case ErlangPackage.BIN_UNIT_TYPE__TYPE:
setType((Type) null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(final int featureID) {
switch (featureID) {
case ErlangPackage.BIN_UNIT_TYPE__TYPE_NAME:
return typeName != null;
case ErlangPackage.BIN_UNIT_TYPE__M:
return M_EDEFAULT == null ? m != null : !M_EDEFAULT.equals(m);
case ErlangPackage.BIN_UNIT_TYPE__TYPE:
return type != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) {
return super.toString();
}
final StringBuffer result = new StringBuffer(super.toString());
result.append(" (m: ");
result.append(m);
result.append(')');
return result.toString();
}
} // BinUnitTypeImpl