/** */ package iot2.impl; import iot2.Board; import iot2.HWComponent; import iot2.Iot2Package; import iot2.Sketch; import java.util.Collection; 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>System</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link iot2.impl.SystemImpl#getName <em>Name</em>}</li> * <li>{@link iot2.impl.SystemImpl#getComponents <em>Components</em>}</li> * <li>{@link iot2.impl.SystemImpl#getBoards <em>Boards</em>}</li> * <li>{@link iot2.impl.SystemImpl#getSketch <em>Sketch</em>}</li> * </ul> * </p> * * @generated */ public class SystemImpl extends MinimalEObjectImpl.Container implements iot2.System { /** * 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 #getComponents() <em>Components</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getComponents() * @generated * @ordered */ protected EList<HWComponent> components; /** * The cached value of the '{@link #getBoards() <em>Boards</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getBoards() * @generated * @ordered */ protected EList<Board> boards; /** * The cached value of the '{@link #getSketch() <em>Sketch</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSketch() * @generated * @ordered */ protected Sketch sketch; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected SystemImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return Iot2Package.Literals.SYSTEM; } /** * <!-- 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, Iot2Package.SYSTEM__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<HWComponent> getComponents() { if (components == null) { components = new EObjectContainmentEList<HWComponent>(HWComponent.class, this, Iot2Package.SYSTEM__COMPONENTS); } return components; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Board> getBoards() { if (boards == null) { boards = new EObjectContainmentEList<Board>(Board.class, this, Iot2Package.SYSTEM__BOARDS); } return boards; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Sketch getSketch() { return sketch; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetSketch(Sketch newSketch, NotificationChain msgs) { Sketch oldSketch = sketch; sketch = newSketch; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Iot2Package.SYSTEM__SKETCH, oldSketch, newSketch); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSketch(Sketch newSketch) { if (newSketch != sketch) { NotificationChain msgs = null; if (sketch != null) msgs = ((InternalEObject)sketch).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Iot2Package.SYSTEM__SKETCH, null, msgs); if (newSketch != null) msgs = ((InternalEObject)newSketch).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Iot2Package.SYSTEM__SKETCH, null, msgs); msgs = basicSetSketch(newSketch, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Iot2Package.SYSTEM__SKETCH, newSketch, newSketch)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case Iot2Package.SYSTEM__COMPONENTS: return ((InternalEList<?>)getComponents()).basicRemove(otherEnd, msgs); case Iot2Package.SYSTEM__BOARDS: return ((InternalEList<?>)getBoards()).basicRemove(otherEnd, msgs); case Iot2Package.SYSTEM__SKETCH: return basicSetSketch(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 Iot2Package.SYSTEM__NAME: return getName(); case Iot2Package.SYSTEM__COMPONENTS: return getComponents(); case Iot2Package.SYSTEM__BOARDS: return getBoards(); case Iot2Package.SYSTEM__SKETCH: return getSketch(); } 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 Iot2Package.SYSTEM__NAME: setName((String)newValue); return; case Iot2Package.SYSTEM__COMPONENTS: getComponents().clear(); getComponents().addAll((Collection<? extends HWComponent>)newValue); return; case Iot2Package.SYSTEM__BOARDS: getBoards().clear(); getBoards().addAll((Collection<? extends Board>)newValue); return; case Iot2Package.SYSTEM__SKETCH: setSketch((Sketch)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case Iot2Package.SYSTEM__NAME: setName(NAME_EDEFAULT); return; case Iot2Package.SYSTEM__COMPONENTS: getComponents().clear(); return; case Iot2Package.SYSTEM__BOARDS: getBoards().clear(); return; case Iot2Package.SYSTEM__SKETCH: setSketch((Sketch)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case Iot2Package.SYSTEM__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case Iot2Package.SYSTEM__COMPONENTS: return components != null && !components.isEmpty(); case Iot2Package.SYSTEM__BOARDS: return boards != null && !boards.isEmpty(); case Iot2Package.SYSTEM__SKETCH: return sketch != 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(); } } //SystemImpl