/** */ package iot2.impl; import iot2.Board; import iot2.BoardType; import iot2.HWComponent; import iot2.Iot2Package; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EObjectResolvingEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Board</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link iot2.impl.BoardImpl#getName <em>Name</em>}</li> * <li>{@link iot2.impl.BoardImpl#getType <em>Type</em>}</li> * <li>{@link iot2.impl.BoardImpl#getComponents <em>Components</em>}</li> * </ul> * </p> * * @generated */ public class BoardImpl extends MinimalEObjectImpl.Container implements Board { /** * 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 default value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected static final BoardType TYPE_EDEFAULT = BoardType.RASPBERRY_PI; /** * The cached value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected BoardType type = TYPE_EDEFAULT; /** * The cached value of the '{@link #getComponents() <em>Components</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getComponents() * @generated * @ordered */ protected EList<HWComponent> components; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected BoardImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return Iot2Package.Literals.BOARD; } /** * <!-- 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.BOARD__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public BoardType getType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setType(BoardType newType) { BoardType oldType = type; type = newType == null ? TYPE_EDEFAULT : newType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Iot2Package.BOARD__TYPE, oldType, type)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<HWComponent> getComponents() { if (components == null) { components = new EObjectResolvingEList<HWComponent>(HWComponent.class, this, Iot2Package.BOARD__COMPONENTS); } return components; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case Iot2Package.BOARD__NAME: return getName(); case Iot2Package.BOARD__TYPE: return getType(); case Iot2Package.BOARD__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 Iot2Package.BOARD__NAME: setName((String)newValue); return; case Iot2Package.BOARD__TYPE: setType((BoardType)newValue); return; case Iot2Package.BOARD__COMPONENTS: getComponents().clear(); getComponents().addAll((Collection<? extends HWComponent>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case Iot2Package.BOARD__NAME: setName(NAME_EDEFAULT); return; case Iot2Package.BOARD__TYPE: setType(TYPE_EDEFAULT); return; case Iot2Package.BOARD__COMPONENTS: getComponents().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case Iot2Package.BOARD__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case Iot2Package.BOARD__TYPE: return type != TYPE_EDEFAULT; case Iot2Package.BOARD__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(", type: "); result.append(type); result.append(')'); return result.toString(); } } //BoardImpl