/**
*/
package org.archstudio.xadl3.structure_3_0.impl;
import java.util.Collection;
import org.archstudio.xadl3.structure_3_0.Direction;
import org.archstudio.xadl3.structure_3_0.Interface;
import org.archstudio.xadl3.structure_3_0.Structure_3_0Package;
import org.archstudio.xadl3.xadlcore_3_0.Extension;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
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.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc --> An implementation of the model object '<em><b>Interface</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.archstudio.xadl3.structure_3_0.impl.InterfaceImpl#getExt <em>Ext</em>}</li>
* <li>{@link org.archstudio.xadl3.structure_3_0.impl.InterfaceImpl#getDirection <em>Direction</em>}</li>
* <li>{@link org.archstudio.xadl3.structure_3_0.impl.InterfaceImpl#getId <em>Id</em>}</li>
* <li>{@link org.archstudio.xadl3.structure_3_0.impl.InterfaceImpl#getName <em>Name</em>}</li>
* </ul>
*
* @generated
*/
public class InterfaceImpl extends MinimalEObjectImpl.Container implements Interface {
/**
* The cached value of the '{@link #getExt() <em>Ext</em>}' containment reference list. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @see #getExt()
* @generated
* @ordered
*/
protected EList<Extension> ext;
/**
* The default value of the '{@link #getDirection() <em>Direction</em>}' attribute. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @see #getDirection()
* @generated
* @ordered
*/
protected static final Direction DIRECTION_EDEFAULT = Direction.NONE;
/**
* The cached value of the '{@link #getDirection() <em>Direction</em>}' attribute. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @see #getDirection()
* @generated
* @ordered
*/
protected Direction direction = DIRECTION_EDEFAULT;
/**
* This is true if the Direction attribute has been set. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
protected boolean directionESet;
/**
* The default value of the '{@link #getId() <em>Id</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getId()
* @generated
* @ordered
*/
protected static final String ID_EDEFAULT = null;
/**
* The cached value of the '{@link #getId() <em>Id</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getId()
* @generated
* @ordered
*/
protected String id = ID_EDEFAULT;
/**
* 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;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected InterfaceImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return Structure_3_0Package.Literals.INTERFACE;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public EList<Extension> getExt() {
if (ext == null) {
ext = new EObjectContainmentEList<Extension>(Extension.class, this, Structure_3_0Package.INTERFACE__EXT);
}
return ext;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public Direction getDirection() {
return direction;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setDirection(Direction newDirection) {
Direction oldDirection = direction;
direction = newDirection == null ? DIRECTION_EDEFAULT : newDirection;
boolean oldDirectionESet = directionESet;
directionESet = true;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, Structure_3_0Package.INTERFACE__DIRECTION,
oldDirection, direction, !oldDirectionESet));
}
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void unsetDirection() {
Direction oldDirection = direction;
boolean oldDirectionESet = directionESet;
direction = DIRECTION_EDEFAULT;
directionESet = false;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.UNSET, Structure_3_0Package.INTERFACE__DIRECTION,
oldDirection, DIRECTION_EDEFAULT, oldDirectionESet));
}
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean isSetDirection() {
return directionESet;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public String getId() {
return id;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setId(String newId) {
String oldId = id;
id = newId;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, Structure_3_0Package.INTERFACE__ID, oldId, id));
}
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public String getName() {
return name;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, Structure_3_0Package.INTERFACE__NAME, oldName, name));
}
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case Structure_3_0Package.INTERFACE__EXT:
return ((InternalEList<?>) getExt()).basicRemove(otherEnd, 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 Structure_3_0Package.INTERFACE__EXT:
return getExt();
case Structure_3_0Package.INTERFACE__DIRECTION:
return getDirection();
case Structure_3_0Package.INTERFACE__ID:
return getId();
case Structure_3_0Package.INTERFACE__NAME:
return getName();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case Structure_3_0Package.INTERFACE__EXT:
getExt().clear();
getExt().addAll((Collection<? extends Extension>) newValue);
return;
case Structure_3_0Package.INTERFACE__DIRECTION:
setDirection((Direction) newValue);
return;
case Structure_3_0Package.INTERFACE__ID:
setId((String) newValue);
return;
case Structure_3_0Package.INTERFACE__NAME:
setName((String) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case Structure_3_0Package.INTERFACE__EXT:
getExt().clear();
return;
case Structure_3_0Package.INTERFACE__DIRECTION:
unsetDirection();
return;
case Structure_3_0Package.INTERFACE__ID:
setId(ID_EDEFAULT);
return;
case Structure_3_0Package.INTERFACE__NAME:
setName(NAME_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case Structure_3_0Package.INTERFACE__EXT:
return ext != null && !ext.isEmpty();
case Structure_3_0Package.INTERFACE__DIRECTION:
return isSetDirection();
case Structure_3_0Package.INTERFACE__ID:
return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
case Structure_3_0Package.INTERFACE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
}
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(" (direction: ");
if (directionESet) {
result.append(direction);
}
else {
result.append("<unset>");
}
result.append(", id: ");
result.append(id);
result.append(", name: ");
result.append(name);
result.append(')');
return result.toString();
}
} // InterfaceImpl