/**
*/
package com.github.lbroudoux.dsl.eip.impl;
import com.github.lbroudoux.dsl.eip.Channel;
import com.github.lbroudoux.dsl.eip.ConditionalRoute;
import com.github.lbroudoux.dsl.eip.EipPackage;
import org.eclipse.emf.common.notify.Notification;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Conditional Route</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link com.github.lbroudoux.dsl.eip.impl.ConditionalRouteImpl#getCondition <em>Condition</em>}</li>
* <li>{@link com.github.lbroudoux.dsl.eip.impl.ConditionalRouteImpl#getChannel <em>Channel</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ConditionalRouteImpl extends MinimalEObjectImpl.Container implements ConditionalRoute {
/**
* The default value of the '{@link #getCondition() <em>Condition</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCondition()
* @generated
* @ordered
*/
protected static final String CONDITION_EDEFAULT = null;
/**
* The cached value of the '{@link #getCondition() <em>Condition</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCondition()
* @generated
* @ordered
*/
protected String condition = CONDITION_EDEFAULT;
/**
* The cached value of the '{@link #getChannel() <em>Channel</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getChannel()
* @generated
* @ordered
*/
protected Channel channel;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ConditionalRouteImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return EipPackage.Literals.CONDITIONAL_ROUTE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getCondition() {
return condition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCondition(String newCondition) {
String oldCondition = condition;
condition = newCondition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EipPackage.CONDITIONAL_ROUTE__CONDITION, oldCondition, condition));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Channel getChannel() {
if (channel != null && channel.eIsProxy()) {
InternalEObject oldChannel = (InternalEObject)channel;
channel = (Channel)eResolveProxy(oldChannel);
if (channel != oldChannel) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, EipPackage.CONDITIONAL_ROUTE__CHANNEL, oldChannel, channel));
}
}
return channel;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Channel basicGetChannel() {
return channel;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setChannel(Channel newChannel) {
Channel oldChannel = channel;
channel = newChannel;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EipPackage.CONDITIONAL_ROUTE__CHANNEL, oldChannel, channel));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case EipPackage.CONDITIONAL_ROUTE__CONDITION:
return getCondition();
case EipPackage.CONDITIONAL_ROUTE__CHANNEL:
if (resolve) return getChannel();
return basicGetChannel();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case EipPackage.CONDITIONAL_ROUTE__CONDITION:
setCondition((String)newValue);
return;
case EipPackage.CONDITIONAL_ROUTE__CHANNEL:
setChannel((Channel)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EipPackage.CONDITIONAL_ROUTE__CONDITION:
setCondition(CONDITION_EDEFAULT);
return;
case EipPackage.CONDITIONAL_ROUTE__CHANNEL:
setChannel((Channel)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EipPackage.CONDITIONAL_ROUTE__CONDITION:
return CONDITION_EDEFAULT == null ? condition != null : !CONDITION_EDEFAULT.equals(condition);
case EipPackage.CONDITIONAL_ROUTE__CHANNEL:
return channel != 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(" (condition: ");
result.append(condition);
result.append(')');
return result.toString();
}
} //ConditionalRouteImpl