/**
*/
package net.certware.intent.state.stateSpecification.impl;
import net.certware.intent.state.stateSpecification.Component;
import net.certware.intent.state.stateSpecification.DeviceOutput;
import net.certware.intent.state.stateSpecification.Output;
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>Device Output</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link net.certware.intent.state.stateSpecification.impl.DeviceOutputImpl#getName <em>Name</em>}</li>
* <li>{@link net.certware.intent.state.stateSpecification.impl.DeviceOutputImpl#getIo <em>Io</em>}</li>
* <li>{@link net.certware.intent.state.stateSpecification.impl.DeviceOutputImpl#getTarget <em>Target</em>}</li>
* </ul>
*
* @generated
*/
public class DeviceOutputImpl extends MinimalEObjectImpl.Container implements DeviceOutput
{
/**
* 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 Output io;
/**
* The cached value of the '{@link #getTarget() <em>Target</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTarget()
* @generated
* @ordered
*/
protected Component target;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DeviceOutputImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return StateSpecificationPackage.Literals.DEVICE_OUTPUT;
}
/**
* <!-- 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.DEVICE_OUTPUT__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Output getIo()
{
return io;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetIo(Output newIo, NotificationChain msgs)
{
Output oldIo = io;
io = newIo;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StateSpecificationPackage.DEVICE_OUTPUT__IO, oldIo, newIo);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIo(Output newIo)
{
if (newIo != io)
{
NotificationChain msgs = null;
if (io != null)
msgs = ((InternalEObject)io).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StateSpecificationPackage.DEVICE_OUTPUT__IO, null, msgs);
if (newIo != null)
msgs = ((InternalEObject)newIo).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StateSpecificationPackage.DEVICE_OUTPUT__IO, null, msgs);
msgs = basicSetIo(newIo, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StateSpecificationPackage.DEVICE_OUTPUT__IO, newIo, newIo));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Component getTarget()
{
if (target != null && target.eIsProxy())
{
InternalEObject oldTarget = (InternalEObject)target;
target = (Component)eResolveProxy(oldTarget);
if (target != oldTarget)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, StateSpecificationPackage.DEVICE_OUTPUT__TARGET, oldTarget, target));
}
}
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Component basicGetTarget()
{
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTarget(Component newTarget)
{
Component oldTarget = target;
target = newTarget;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StateSpecificationPackage.DEVICE_OUTPUT__TARGET, oldTarget, target));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case StateSpecificationPackage.DEVICE_OUTPUT__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.DEVICE_OUTPUT__NAME:
return getName();
case StateSpecificationPackage.DEVICE_OUTPUT__IO:
return getIo();
case StateSpecificationPackage.DEVICE_OUTPUT__TARGET:
if (resolve) return getTarget();
return basicGetTarget();
}
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.DEVICE_OUTPUT__NAME:
setName((String)newValue);
return;
case StateSpecificationPackage.DEVICE_OUTPUT__IO:
setIo((Output)newValue);
return;
case StateSpecificationPackage.DEVICE_OUTPUT__TARGET:
setTarget((Component)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case StateSpecificationPackage.DEVICE_OUTPUT__NAME:
setName(NAME_EDEFAULT);
return;
case StateSpecificationPackage.DEVICE_OUTPUT__IO:
setIo((Output)null);
return;
case StateSpecificationPackage.DEVICE_OUTPUT__TARGET:
setTarget((Component)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case StateSpecificationPackage.DEVICE_OUTPUT__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case StateSpecificationPackage.DEVICE_OUTPUT__IO:
return io != null;
case StateSpecificationPackage.DEVICE_OUTPUT__TARGET:
return target != 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();
}
} //DeviceOutputImpl