/**
* <copyright>
* </copyright>
*
* $Id$
*/
package no.hal.scxml.scxmlxt.impl;
import no.hal.scxml.scxmlxt.EStepFilter;
import no.hal.scxml.scxmlxt.ScriptExpression;
import no.hal.scxml.scxmlxt.ScxmlxtPackage;
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.EObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>EStep Filter</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link no.hal.scxml.scxmlxt.impl.EStepFilterImpl#getFreeVarName <em>Free Var Name</em>}</li>
* <li>{@link no.hal.scxml.scxmlxt.impl.EStepFilterImpl#getScript <em>Script</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class EStepFilterImpl extends EObjectImpl implements EStepFilter {
/**
* The default value of the '{@link #getFreeVarName() <em>Free Var Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFreeVarName()
* @generated
* @ordered
*/
protected static final String FREE_VAR_NAME_EDEFAULT = "\"$\"";
/**
* The cached value of the '{@link #getFreeVarName() <em>Free Var Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFreeVarName()
* @generated
* @ordered
*/
protected String freeVarName = FREE_VAR_NAME_EDEFAULT;
/**
* The cached value of the '{@link #getScript() <em>Script</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getScript()
* @generated
* @ordered
*/
protected ScriptExpression script;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EStepFilterImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ScxmlxtPackage.Literals.ESTEP_FILTER;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getFreeVarName() {
return freeVarName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFreeVarName(String newFreeVarName) {
String oldFreeVarName = freeVarName;
freeVarName = newFreeVarName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ScxmlxtPackage.ESTEP_FILTER__FREE_VAR_NAME, oldFreeVarName, freeVarName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ScriptExpression getScript() {
return script;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetScript(ScriptExpression newScript, NotificationChain msgs) {
ScriptExpression oldScript = script;
script = newScript;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ScxmlxtPackage.ESTEP_FILTER__SCRIPT, oldScript, newScript);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setScript(ScriptExpression newScript) {
if (newScript != script) {
NotificationChain msgs = null;
if (script != null)
msgs = ((InternalEObject)script).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ScxmlxtPackage.ESTEP_FILTER__SCRIPT, null, msgs);
if (newScript != null)
msgs = ((InternalEObject)newScript).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ScxmlxtPackage.ESTEP_FILTER__SCRIPT, null, msgs);
msgs = basicSetScript(newScript, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ScxmlxtPackage.ESTEP_FILTER__SCRIPT, newScript, newScript));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ScxmlxtPackage.ESTEP_FILTER__SCRIPT:
return basicSetScript(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 ScxmlxtPackage.ESTEP_FILTER__FREE_VAR_NAME:
return getFreeVarName();
case ScxmlxtPackage.ESTEP_FILTER__SCRIPT:
return getScript();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ScxmlxtPackage.ESTEP_FILTER__FREE_VAR_NAME:
setFreeVarName((String)newValue);
return;
case ScxmlxtPackage.ESTEP_FILTER__SCRIPT:
setScript((ScriptExpression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ScxmlxtPackage.ESTEP_FILTER__FREE_VAR_NAME:
setFreeVarName(FREE_VAR_NAME_EDEFAULT);
return;
case ScxmlxtPackage.ESTEP_FILTER__SCRIPT:
setScript((ScriptExpression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ScxmlxtPackage.ESTEP_FILTER__FREE_VAR_NAME:
return FREE_VAR_NAME_EDEFAULT == null ? freeVarName != null : !FREE_VAR_NAME_EDEFAULT.equals(freeVarName);
case ScxmlxtPackage.ESTEP_FILTER__SCRIPT:
return script != null;
}
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(" (freeVarName: ");
result.append(freeVarName);
result.append(')');
return result.toString();
}
} //EStepFilterImpl