/** */ package net.certware.intent.state.stateSpecification.impl; import java.util.Collection; import net.certware.intent.state.stateSpecification.Component; import net.certware.intent.state.stateSpecification.Device; import net.certware.intent.state.stateSpecification.Specification; 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.common.util.EList; 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 org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Specification</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link net.certware.intent.state.stateSpecification.impl.SpecificationImpl#getName <em>Name</em>}</li> * <li>{@link net.certware.intent.state.stateSpecification.impl.SpecificationImpl#getDevices <em>Devices</em>}</li> * <li>{@link net.certware.intent.state.stateSpecification.impl.SpecificationImpl#getComponents <em>Components</em>}</li> * </ul> * * @generated */ public class SpecificationImpl extends MinimalEObjectImpl.Container implements Specification { /** * 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 #getDevices() <em>Devices</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDevices() * @generated * @ordered */ protected EList<Device> devices; /** * The cached value of the '{@link #getComponents() <em>Components</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getComponents() * @generated * @ordered */ protected EList<Component> components; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected SpecificationImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return StateSpecificationPackage.Literals.SPECIFICATION; } /** * <!-- 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.SPECIFICATION__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Device> getDevices() { if (devices == null) { devices = new EObjectContainmentEList<Device>(Device.class, this, StateSpecificationPackage.SPECIFICATION__DEVICES); } return devices; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Component> getComponents() { if (components == null) { components = new EObjectContainmentEList<Component>(Component.class, this, StateSpecificationPackage.SPECIFICATION__COMPONENTS); } return components; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case StateSpecificationPackage.SPECIFICATION__DEVICES: return ((InternalEList<?>)getDevices()).basicRemove(otherEnd, msgs); case StateSpecificationPackage.SPECIFICATION__COMPONENTS: return ((InternalEList<?>)getComponents()).basicRemove(otherEnd, 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.SPECIFICATION__NAME: return getName(); case StateSpecificationPackage.SPECIFICATION__DEVICES: return getDevices(); case StateSpecificationPackage.SPECIFICATION__COMPONENTS: return getComponents(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case StateSpecificationPackage.SPECIFICATION__NAME: setName((String)newValue); return; case StateSpecificationPackage.SPECIFICATION__DEVICES: getDevices().clear(); getDevices().addAll((Collection<? extends Device>)newValue); return; case StateSpecificationPackage.SPECIFICATION__COMPONENTS: getComponents().clear(); getComponents().addAll((Collection<? extends Component>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case StateSpecificationPackage.SPECIFICATION__NAME: setName(NAME_EDEFAULT); return; case StateSpecificationPackage.SPECIFICATION__DEVICES: getDevices().clear(); return; case StateSpecificationPackage.SPECIFICATION__COMPONENTS: getComponents().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case StateSpecificationPackage.SPECIFICATION__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case StateSpecificationPackage.SPECIFICATION__DEVICES: return devices != null && !devices.isEmpty(); case StateSpecificationPackage.SPECIFICATION__COMPONENTS: return components != null && !components.isEmpty(); } 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(); } } //SpecificationImpl