/**
* <copyright>
* </copyright>
*
* $Id$
*/
package tefkat.engine.runtime.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.BasicEList;
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.EObjectImpl;
import org.eclipse.emf.ecore.util.EDataTypeEList;
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;
import tefkat.engine.runtime.RuntimePackage;
import tefkat.engine.runtime.Var;
import tefkat.engine.runtime.VarScope;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Var Scope</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link tefkat.engine.runtime.impl.VarScopeImpl#getVars <em>Vars</em>}</li>
* <li>{@link tefkat.engine.runtime.impl.VarScopeImpl#getName <em>Name</em>}</li>
* <li>{@link tefkat.engine.runtime.impl.VarScopeImpl#getComments <em>Comments</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class VarScopeImpl extends EObjectImpl implements VarScope {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String copyright = "Copyright michael lawley 2004";
/**
* The cached value of the '{@link #getVars() <em>Vars</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVars()
* @generated
* @ordered
*/
protected EList vars = null;
/**
* 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;
/**
* The cached value of the '{@link #getComments() <em>Comments</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getComments()
* @generated
* @ordered
*/
protected EList comments = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected VarScopeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return RuntimePackage.Literals.VAR_SCOPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getVars() {
if (vars == null) {
vars = new EObjectContainmentWithInverseEList(Var.class, this, RuntimePackage.VAR_SCOPE__VARS, RuntimePackage.VAR__SCOPE);
}
return vars;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.VAR_SCOPE__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getComments() {
if (comments == null) {
comments = new EDataTypeEList(String.class, this, RuntimePackage.VAR_SCOPE__COMMENTS);
}
return comments;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case RuntimePackage.VAR_SCOPE__VARS:
return ((InternalEList)getVars()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case RuntimePackage.VAR_SCOPE__VARS:
return ((InternalEList)getVars()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case RuntimePackage.VAR_SCOPE__VARS:
return getVars();
case RuntimePackage.VAR_SCOPE__NAME:
return getName();
case RuntimePackage.VAR_SCOPE__COMMENTS:
return getComments();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case RuntimePackage.VAR_SCOPE__VARS:
getVars().clear();
getVars().addAll((Collection)newValue);
return;
case RuntimePackage.VAR_SCOPE__NAME:
setName((String)newValue);
return;
case RuntimePackage.VAR_SCOPE__COMMENTS:
getComments().clear();
getComments().addAll((Collection)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case RuntimePackage.VAR_SCOPE__VARS:
getVars().clear();
return;
case RuntimePackage.VAR_SCOPE__NAME:
setName(NAME_EDEFAULT);
return;
case RuntimePackage.VAR_SCOPE__COMMENTS:
getComments().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case RuntimePackage.VAR_SCOPE__VARS:
return vars != null && !vars.isEmpty();
case RuntimePackage.VAR_SCOPE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case RuntimePackage.VAR_SCOPE__COMMENTS:
return comments != null && !comments.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
result.append(", comments: ");
result.append(comments);
result.append(')');
return result.toString();
}
} //VarScopeImpl