/**
*/
package net.certware.intent.state.stateSpecification.impl;
import net.certware.intent.state.stateSpecification.ComponentInput;
import net.certware.intent.state.stateSpecification.Device;
import net.certware.intent.state.stateSpecification.Input;
import net.certware.intent.state.stateSpecification.StateSpecificationPackage;
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.MinimalEObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Component Input</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link net.certware.intent.state.stateSpecification.impl.ComponentInputImpl#getName <em>Name</em>}</li>
* <li>{@link net.certware.intent.state.stateSpecification.impl.ComponentInputImpl#getIo <em>Io</em>}</li>
* <li>{@link net.certware.intent.state.stateSpecification.impl.ComponentInputImpl#getSource <em>Source</em>}</li>
* </ul>
*
* @generated
*/
public class ComponentInputImpl extends MinimalEObjectImpl.Container implements ComponentInput
{
/**
* 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 #getIo() <em>Io</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIo()
* @generated
* @ordered
*/
protected Input io;
/**
* The cached value of the '{@link #getSource() <em>Source</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSource()
* @generated
* @ordered
*/
protected Device source;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ComponentInputImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return StateSpecificationPackage.Literals.COMPONENT_INPUT;
}
/**
* <!-- 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, StateSpecificationPackage.COMPONENT_INPUT__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Input getIo()
{
return io;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetIo(Input newIo, NotificationChain msgs)
{
Input oldIo = io;
io = newIo;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StateSpecificationPackage.COMPONENT_INPUT__IO, oldIo, newIo);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIo(Input newIo)
{
if (newIo != io)
{
NotificationChain msgs = null;
if (io != null)
msgs = ((InternalEObject)io).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StateSpecificationPackage.COMPONENT_INPUT__IO, null, msgs);
if (newIo != null)
msgs = ((InternalEObject)newIo).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StateSpecificationPackage.COMPONENT_INPUT__IO, null, msgs);
msgs = basicSetIo(newIo, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StateSpecificationPackage.COMPONENT_INPUT__IO, newIo, newIo));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Device getSource()
{
if (source != null && source.eIsProxy())
{
InternalEObject oldSource = (InternalEObject)source;
source = (Device)eResolveProxy(oldSource);
if (source != oldSource)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, StateSpecificationPackage.COMPONENT_INPUT__SOURCE, oldSource, source));
}
}
return source;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Device basicGetSource()
{
return source;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSource(Device newSource)
{
Device oldSource = source;
source = newSource;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StateSpecificationPackage.COMPONENT_INPUT__SOURCE, oldSource, source));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case StateSpecificationPackage.COMPONENT_INPUT__IO:
return basicSetIo(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 StateSpecificationPackage.COMPONENT_INPUT__NAME:
return getName();
case StateSpecificationPackage.COMPONENT_INPUT__IO:
return getIo();
case StateSpecificationPackage.COMPONENT_INPUT__SOURCE:
if (resolve) return getSource();
return basicGetSource();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case StateSpecificationPackage.COMPONENT_INPUT__NAME:
setName((String)newValue);
return;
case StateSpecificationPackage.COMPONENT_INPUT__IO:
setIo((Input)newValue);
return;
case StateSpecificationPackage.COMPONENT_INPUT__SOURCE:
setSource((Device)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case StateSpecificationPackage.COMPONENT_INPUT__NAME:
setName(NAME_EDEFAULT);
return;
case StateSpecificationPackage.COMPONENT_INPUT__IO:
setIo((Input)null);
return;
case StateSpecificationPackage.COMPONENT_INPUT__SOURCE:
setSource((Device)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case StateSpecificationPackage.COMPONENT_INPUT__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case StateSpecificationPackage.COMPONENT_INPUT__IO:
return io != null;
case StateSpecificationPackage.COMPONENT_INPUT__SOURCE:
return source != 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(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //ComponentInputImpl