/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.csu.idl.idlmm.impl;
import org.csu.idl.idlmm.Expression;
import org.csu.idl.idlmm.IDLType;
import org.csu.idl.idlmm.IdlmmPackage;
import org.csu.idl.idlmm.SequenceDef;
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>Sequence Def</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.csu.idl.idlmm.impl.SequenceDefImpl#getTypeCode <em>Type Code</em>}</li>
* <li>{@link org.csu.idl.idlmm.impl.SequenceDefImpl#getBound <em>Bound</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class SequenceDefImpl extends TypedImpl implements SequenceDef {
/**
* The default value of the '{@link #getTypeCode() <em>Type Code</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTypeCode()
* @generated
* @ordered
*/
protected static final String TYPE_CODE_EDEFAULT = null;
/**
* The cached value of the '{@link #getTypeCode() <em>Type Code</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTypeCode()
* @generated
* @ordered
*/
protected String typeCode = TYPE_CODE_EDEFAULT;
/**
* The cached value of the '{@link #getBound() <em>Bound</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBound()
* @generated
* @ordered
*/
protected Expression bound;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SequenceDefImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return IdlmmPackage.Literals.SEQUENCE_DEF;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getTypeCode() {
return typeCode;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTypeCode(String newTypeCode) {
String oldTypeCode = typeCode;
typeCode = newTypeCode;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, IdlmmPackage.SEQUENCE_DEF__TYPE_CODE, oldTypeCode, typeCode));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getBound() {
return bound;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetBound(Expression newBound, NotificationChain msgs) {
Expression oldBound = bound;
bound = newBound;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IdlmmPackage.SEQUENCE_DEF__BOUND, oldBound, newBound);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBound(Expression newBound) {
if (newBound != bound) {
NotificationChain msgs = null;
if (bound != null)
msgs = ((InternalEObject)bound).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - IdlmmPackage.SEQUENCE_DEF__BOUND, null, msgs);
if (newBound != null)
msgs = ((InternalEObject)newBound).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - IdlmmPackage.SEQUENCE_DEF__BOUND, null, msgs);
msgs = basicSetBound(newBound, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, IdlmmPackage.SEQUENCE_DEF__BOUND, newBound, newBound));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case IdlmmPackage.SEQUENCE_DEF__BOUND:
return basicSetBound(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 IdlmmPackage.SEQUENCE_DEF__TYPE_CODE:
return getTypeCode();
case IdlmmPackage.SEQUENCE_DEF__BOUND:
return getBound();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case IdlmmPackage.SEQUENCE_DEF__TYPE_CODE:
setTypeCode((String)newValue);
return;
case IdlmmPackage.SEQUENCE_DEF__BOUND:
setBound((Expression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case IdlmmPackage.SEQUENCE_DEF__TYPE_CODE:
setTypeCode(TYPE_CODE_EDEFAULT);
return;
case IdlmmPackage.SEQUENCE_DEF__BOUND:
setBound((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case IdlmmPackage.SEQUENCE_DEF__TYPE_CODE:
return TYPE_CODE_EDEFAULT == null ? typeCode != null : !TYPE_CODE_EDEFAULT.equals(typeCode);
case IdlmmPackage.SEQUENCE_DEF__BOUND:
return bound != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == IDLType.class) {
switch (derivedFeatureID) {
case IdlmmPackage.SEQUENCE_DEF__TYPE_CODE: return IdlmmPackage.IDL_TYPE__TYPE_CODE;
default: return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
if (baseClass == IDLType.class) {
switch (baseFeatureID) {
case IdlmmPackage.IDL_TYPE__TYPE_CODE: return IdlmmPackage.SEQUENCE_DEF__TYPE_CODE;
default: return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (typeCode: ");
result.append(typeCode);
result.append(')');
return result.toString();
}
} //SequenceDefImpl