/**
*/
package satellite.impl;
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;
import satellite.AntennaGain;
import satellite.CommSubsystem;
import satellite.DirectedCommunicationLink;
import satellite.SatellitePackage;
import satellite.TransceiverBand;
/**
*
* An implementation of the model object 'Comm Subsystem'.
*
*
* The following features are implemented:
*
*
* - {@link satellite.impl.CommSubsystemImpl#getBand Band}
* - {@link satellite.impl.CommSubsystemImpl#getGain Gain}
* - {@link satellite.impl.CommSubsystemImpl#getCommunicationLink Communication Link}
*
*
* @generated
*/
public class CommSubsystemImpl extends MinimalEObjectImpl.Container implements CommSubsystem {
/**
* The default value of the '{@link #getBand() Band}' attribute.
*
*
* @see #getBand()
* @generated
* @ordered
*/
protected static final TransceiverBand BAND_EDEFAULT = TransceiverBand.UHF;
/**
* The cached value of the '{@link #getBand() Band}' attribute.
*
*
* @see #getBand()
* @generated
* @ordered
*/
protected TransceiverBand band = BAND_EDEFAULT;
/**
* The default value of the '{@link #getGain() Gain}' attribute.
*
*
* @see #getGain()
* @generated
* @ordered
*/
protected static final AntennaGain GAIN_EDEFAULT = AntennaGain.LOW;
/**
* The cached value of the '{@link #getGain() Gain}' attribute.
*
*
* @see #getGain()
* @generated
* @ordered
*/
protected AntennaGain gain = GAIN_EDEFAULT;
/**
* The cached value of the '{@link #getCommunicationLink() Communication Link}' containment reference.
*
*
* @see #getCommunicationLink()
* @generated
* @ordered
*/
protected DirectedCommunicationLink communicationLink;
/**
*
*
* @generated
*/
protected CommSubsystemImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return SatellitePackage.Literals.COMM_SUBSYSTEM;
}
/**
*
*
* @generated
*/
@Override
public TransceiverBand getBand() {
return band;
}
/**
*
*
* @generated
*/
@Override
public void setBand(TransceiverBand newBand) {
TransceiverBand oldBand = band;
band = newBand == null ? BAND_EDEFAULT : newBand;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SatellitePackage.COMM_SUBSYSTEM__BAND, oldBand,
band));
}
/**
*
*
* @generated
*/
@Override
public AntennaGain getGain() {
return gain;
}
/**
*
*
* @generated
*/
@Override
public void setGain(AntennaGain newGain) {
AntennaGain oldGain = gain;
gain = newGain == null ? GAIN_EDEFAULT : newGain;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SatellitePackage.COMM_SUBSYSTEM__GAIN, oldGain,
gain));
}
/**
*
*
* @generated
*/
@Override
public DirectedCommunicationLink getCommunicationLink() {
return communicationLink;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetCommunicationLink(DirectedCommunicationLink newCommunicationLink,
NotificationChain msgs) {
DirectedCommunicationLink oldCommunicationLink = communicationLink;
communicationLink = newCommunicationLink;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
SatellitePackage.COMM_SUBSYSTEM__COMMUNICATION_LINK, oldCommunicationLink, newCommunicationLink);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setCommunicationLink(DirectedCommunicationLink newCommunicationLink) {
if (newCommunicationLink != communicationLink) {
NotificationChain msgs = null;
if (communicationLink != null)
msgs = ((InternalEObject) communicationLink).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE - SatellitePackage.COMM_SUBSYSTEM__COMMUNICATION_LINK, null, msgs);
if (newCommunicationLink != null)
msgs = ((InternalEObject) newCommunicationLink).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE - SatellitePackage.COMM_SUBSYSTEM__COMMUNICATION_LINK, null, msgs);
msgs = basicSetCommunicationLink(newCommunicationLink, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SatellitePackage.COMM_SUBSYSTEM__COMMUNICATION_LINK,
newCommunicationLink, newCommunicationLink));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SatellitePackage.COMM_SUBSYSTEM__COMMUNICATION_LINK:
return basicSetCommunicationLink(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case SatellitePackage.COMM_SUBSYSTEM__BAND:
return getBand();
case SatellitePackage.COMM_SUBSYSTEM__GAIN:
return getGain();
case SatellitePackage.COMM_SUBSYSTEM__COMMUNICATION_LINK:
return getCommunicationLink();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case SatellitePackage.COMM_SUBSYSTEM__BAND:
setBand((TransceiverBand) newValue);
return;
case SatellitePackage.COMM_SUBSYSTEM__GAIN:
setGain((AntennaGain) newValue);
return;
case SatellitePackage.COMM_SUBSYSTEM__COMMUNICATION_LINK:
setCommunicationLink((DirectedCommunicationLink) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case SatellitePackage.COMM_SUBSYSTEM__BAND:
setBand(BAND_EDEFAULT);
return;
case SatellitePackage.COMM_SUBSYSTEM__GAIN:
setGain(GAIN_EDEFAULT);
return;
case SatellitePackage.COMM_SUBSYSTEM__COMMUNICATION_LINK:
setCommunicationLink((DirectedCommunicationLink) null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SatellitePackage.COMM_SUBSYSTEM__BAND:
return band != BAND_EDEFAULT;
case SatellitePackage.COMM_SUBSYSTEM__GAIN:
return gain != GAIN_EDEFAULT;
case SatellitePackage.COMM_SUBSYSTEM__COMMUNICATION_LINK:
return communicationLink != null;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy())
return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (band: ");
result.append(band);
result.append(", gain: ");
result.append(gain);
result.append(')');
return result.toString();
}
} //CommSubsystemImpl