code: /**
   */
  package co.edu.uniandes.accordant_dv.impl;
  
  import co.edu.uniandes.accordant_dv.Accordant_dvPackage;
  import co.edu.uniandes.accordant_dv.DeploymentView;
  import co.edu.uniandes.accordant_dv.Device;
  import co.edu.uniandes.accordant_dv.Pod;
  import co.edu.uniandes.accordant_dv.TypeDevice;
  
  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.EObjectWithInverseResolvingEList;
  import org.eclipse.emf.ecore.util.EcoreUtil;
  import org.eclipse.emf.ecore.util.InternalEList;
  
  /**
   * <!-- begin-user-doc -->
   * An implementation of the model object '<em><b>Device</b></em>'.
   * <!-- end-user-doc -->
   * <p>
   * The following features are implemented:
   * </p>
   * <ul>
   *   <li>{@link co.edu.uniandes.accordant_dv.impl.DeviceImpl#getHost <em>Host</em>}</li>
   *   <li>{@link co.edu.uniandes.accordant_dv.impl.DeviceImpl#getType <em>Type</em>}</li>
   *   <li>{@link co.edu.uniandes.accordant_dv.impl.DeviceImpl#getCpu <em>Cpu</em>}</li>
   *   <li>{@link co.edu.uniandes.accordant_dv.impl.DeviceImpl#getStorage <em>Storage</em>}</li>
   *   <li>{@link co.edu.uniandes.accordant_dv.impl.DeviceImpl#getMem <em>Mem</em>}</li>
   *   <li>{@link co.edu.uniandes.accordant_dv.impl.DeviceImpl#getName <em>Name</em>}</li>
   *   <li>{@link co.edu.uniandes.accordant_dv.impl.DeviceImpl#getOs <em>Os</em>}</li>
   *   <li>{@link co.edu.uniandes.accordant_dv.impl.DeviceImpl#getPods <em>Pods</em>}</li>
   *   <li>{@link co.edu.uniandes.accordant_dv.impl.DeviceImpl#getDv <em>Dv</em>}</li>
   * </ul>
   *
   * @generated
   */
  public class DeviceImpl extends MinimalEObjectImpl.Container implements Device {
  	/**
  	 * The default value of the '{@link #getHost() <em>Host</em>}' attribute.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @see #getHost()
  	 * @generated
  	 * @ordered
  	 */
  	protected static final String HOST_EDEFAULT = null;
  
  	/**
  	 * The cached value of the '{@link #getHost() <em>Host</em>}' attribute.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @see #getHost()
  	 * @generated
  	 * @ordered
  	 */
  	protected String host = HOST_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 TypeDevice TYPE_EDEFAULT = TypeDevice.MEDIUM;
  
  	/**
  	 * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @see #getType()
  	 * @generated
  	 * @ordered
  	 */
  	protected TypeDevice type = TYPE_EDEFAULT;
  
  	/**
  	 * The default value of the '{@link #getCpu() <em>Cpu</em>}' attribute.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @see #getCpu()
  	 * @generated
  	 * @ordered
  	 */
  	protected static final int CPU_EDEFAULT = 0;
  
  	/**
  	 * The cached value of the '{@link #getCpu() <em>Cpu</em>}' attribute.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @see #getCpu()
  	 * @generated
  	 * @ordered
  	 */
  	protected int cpu = CPU_EDEFAULT;
  
  	/**
  	 * The default value of the '{@link #getStorage() <em>Storage</em>}' attribute.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @see #getStorage()
  	 * @generated
  	 * @ordered
  	 */
  	protected static final int STORAGE_EDEFAULT = 0;
  
  	/**
  	 * The cached value of the '{@link #getStorage() <em>Storage</em>}' attribute.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @see #getStorage()
  	 * @generated
  	 * @ordered
  	 */
  	protected int storage = STORAGE_EDEFAULT;
  
  	/**
  	 * The default value of the '{@link #getMem() <em>Mem</em>}' attribute.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @see #getMem()
  	 * @generated
  	 * @ordered
  	 */
  	protected static final int MEM_EDEFAULT = 0;
  
  	/**
  	 * The cached value of the '{@link #getMem() <em>Mem</em>}' attribute.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @see #getMem()
  	 * @generated
  	 * @ordered
  	 */
  	protected int mem = MEM_EDEFAULT;
  
  	/**
  	 * 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 #getOs() <em>Os</em>}' attribute.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @see #getOs()
  	 * @generated
  	 * @ordered
  	 */
  	protected static final String OS_EDEFAULT = null;
  
  	/**
  	 * The cached value of the '{@link #getOs() <em>Os</em>}' attribute.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @see #getOs()
  	 * @generated
  	 * @ordered
  	 */
  	protected String os = OS_EDEFAULT;
  
  	/**
  	 * The cached value of the '{@link #getPods() <em>Pods</em>}' reference list.
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @see #getPods()
  	 * @generated
  	 * @ordered
  	 */
  	protected EList<Pod> pods;
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	protected DeviceImpl() {
  		super();
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	protected EClass eStaticClass() {
  		return Accordant_dvPackage.Literals.DEVICE;
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public String getHost() {
  		return host;
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public void setHost(String newHost) {
  		String oldHost = host;
  		host = newHost;
  		if (eNotificationRequired())
  			eNotify(new ENotificationImpl(this, Notification.SET, Accordant_dvPackage.DEVICE__HOST, oldHost, host));
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public TypeDevice getType() {
  		return type;
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public void setType(TypeDevice newType) {
  		TypeDevice oldType = type;
  		type = newType == null ? TYPE_EDEFAULT : newType;
  		if (eNotificationRequired())
  			eNotify(new ENotificationImpl(this, Notification.SET, Accordant_dvPackage.DEVICE__TYPE, oldType, type));
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public int getCpu() {
  		return cpu;
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public void setCpu(int newCpu) {
  		int oldCpu = cpu;
  		cpu = newCpu;
  		if (eNotificationRequired())
  			eNotify(new ENotificationImpl(this, Notification.SET, Accordant_dvPackage.DEVICE__CPU, oldCpu, cpu));
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public int getStorage() {
  		return storage;
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public void setStorage(int newStorage) {
  		int oldStorage = storage;
  		storage = newStorage;
  		if (eNotificationRequired())
  			eNotify(new ENotificationImpl(this, Notification.SET, Accordant_dvPackage.DEVICE__STORAGE, oldStorage, storage));
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public int getMem() {
  		return mem;
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public void setMem(int newMem) {
  		int oldMem = mem;
  		mem = newMem;
  		if (eNotificationRequired())
  			eNotify(new ENotificationImpl(this, Notification.SET, Accordant_dvPackage.DEVICE__MEM, oldMem, mem));
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public String getName() {
  		return name;
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public void setName(String newName) {
  		String oldName = name;
  		name = newName;
  		if (eNotificationRequired())
  			eNotify(new ENotificationImpl(this, Notification.SET, Accordant_dvPackage.DEVICE__NAME, oldName, name));
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public String getOs() {
  		return os;
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public void setOs(String newOs) {
  		String oldOs = os;
  		os = newOs;
  		if (eNotificationRequired())
  			eNotify(new ENotificationImpl(this, Notification.SET, Accordant_dvPackage.DEVICE__OS, oldOs, os));
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public EList<Pod> getPods() {
  		if (pods == null) {
  			pods = new EObjectWithInverseResolvingEList<Pod>(Pod.class, this, Accordant_dvPackage.DEVICE__PODS, Accordant_dvPackage.POD__NODE);
  		}
  		return pods;
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public DeploymentView getDv() {
  		if (eContainerFeatureID() != Accordant_dvPackage.DEVICE__DV) return null;
  		return (DeploymentView)eInternalContainer();
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	public NotificationChain basicSetDv(DeploymentView newDv, NotificationChain msgs) {
  		msgs = eBasicSetContainer((InternalEObject)newDv, Accordant_dvPackage.DEVICE__DV, msgs);
  		return msgs;
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public void setDv(DeploymentView newDv) {
  		if (newDv != eInternalContainer() || (eContainerFeatureID() != Accordant_dvPackage.DEVICE__DV && newDv != null)) {
  			if (EcoreUtil.isAncestor(this, newDv))
  				throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
  			NotificationChain msgs = null;
  			if (eInternalContainer() != null)
  				msgs = eBasicRemoveFromContainer(msgs);
  			if (newDv != null)
  				msgs = ((InternalEObject)newDv).eInverseAdd(this, Accordant_dvPackage.DEPLOYMENT_VIEW__DEVS, DeploymentView.class, msgs);
  			msgs = basicSetDv(newDv, msgs);
  			if (msgs != null) msgs.dispatch();
  		}
  		else if (eNotificationRequired())
  			eNotify(new ENotificationImpl(this, Notification.SET, Accordant_dvPackage.DEVICE__DV, newDv, newDv));
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@SuppressWarnings("unchecked")
  	@Override
  	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
  		switch (featureID) {
  			case Accordant_dvPackage.DEVICE__PODS:
  				return ((InternalEList<InternalEObject>)(InternalEList<?>)getPods()).basicAdd(otherEnd, msgs);
  			case Accordant_dvPackage.DEVICE__DV:
  				if (eInternalContainer() != null)
  					msgs = eBasicRemoveFromContainer(msgs);
  				return basicSetDv((DeploymentView)otherEnd, msgs);
  		}
  		return super.eInverseAdd(otherEnd, featureID, msgs);
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
  		switch (featureID) {
  			case Accordant_dvPackage.DEVICE__PODS:
  				return ((InternalEList<?>)getPods()).basicRemove(otherEnd, msgs);
  			case Accordant_dvPackage.DEVICE__DV:
  				return basicSetDv(null, msgs);
  		}
  		return super.eInverseRemove(otherEnd, featureID, msgs);
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
  		switch (eContainerFeatureID()) {
  			case Accordant_dvPackage.DEVICE__DV:
  				return eInternalContainer().eInverseRemove(this, Accordant_dvPackage.DEPLOYMENT_VIEW__DEVS, DeploymentView.class, msgs);
  		}
  		return super.eBasicRemoveFromContainerFeature(msgs);
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public Object eGet(int featureID, boolean resolve, boolean coreType) {
  		switch (featureID) {
  			case Accordant_dvPackage.DEVICE__HOST:
  				return getHost();
  			case Accordant_dvPackage.DEVICE__TYPE:
  				return getType();
  			case Accordant_dvPackage.DEVICE__CPU:
  				return getCpu();
  			case Accordant_dvPackage.DEVICE__STORAGE:
  				return getStorage();
  			case Accordant_dvPackage.DEVICE__MEM:
  				return getMem();
  			case Accordant_dvPackage.DEVICE__NAME:
  				return getName();
  			case Accordant_dvPackage.DEVICE__OS:
  				return getOs();
  			case Accordant_dvPackage.DEVICE__PODS:
  				return getPods();
  			case Accordant_dvPackage.DEVICE__DV:
  				return getDv();
  		}
  		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 Accordant_dvPackage.DEVICE__HOST:
  				setHost((String)newValue);
  				return;
  			case Accordant_dvPackage.DEVICE__TYPE:
  				setType((TypeDevice)newValue);
  				return;
  			case Accordant_dvPackage.DEVICE__CPU:
  				setCpu((Integer)newValue);
  				return;
  			case Accordant_dvPackage.DEVICE__STORAGE:
  				setStorage((Integer)newValue);
  				return;
  			case Accordant_dvPackage.DEVICE__MEM:
  				setMem((Integer)newValue);
  				return;
  			case Accordant_dvPackage.DEVICE__NAME:
  				setName((String)newValue);
  				return;
  			case Accordant_dvPackage.DEVICE__OS:
  				setOs((String)newValue);
  				return;
  			case Accordant_dvPackage.DEVICE__PODS:
  				getPods().clear();
  				getPods().addAll((Collection<? extends Pod>)newValue);
  				return;
  			case Accordant_dvPackage.DEVICE__DV:
  				setDv((DeploymentView)newValue);
  				return;
  		}
  		super.eSet(featureID, newValue);
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public void eUnset(int featureID) {
  		switch (featureID) {
  			case Accordant_dvPackage.DEVICE__HOST:
  				setHost(HOST_EDEFAULT);
  				return;
  			case Accordant_dvPackage.DEVICE__TYPE:
  				setType(TYPE_EDEFAULT);
  				return;
  			case Accordant_dvPackage.DEVICE__CPU:
  				setCpu(CPU_EDEFAULT);
  				return;
  			case Accordant_dvPackage.DEVICE__STORAGE:
  				setStorage(STORAGE_EDEFAULT);
  				return;
  			case Accordant_dvPackage.DEVICE__MEM:
  				setMem(MEM_EDEFAULT);
  				return;
  			case Accordant_dvPackage.DEVICE__NAME:
  				setName(NAME_EDEFAULT);
  				return;
  			case Accordant_dvPackage.DEVICE__OS:
  				setOs(OS_EDEFAULT);
  				return;
  			case Accordant_dvPackage.DEVICE__PODS:
  				getPods().clear();
  				return;
  			case Accordant_dvPackage.DEVICE__DV:
  				setDv((DeploymentView)null);
  				return;
  		}
  		super.eUnset(featureID);
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public boolean eIsSet(int featureID) {
  		switch (featureID) {
  			case Accordant_dvPackage.DEVICE__HOST:
  				return HOST_EDEFAULT == null ? host != null : !HOST_EDEFAULT.equals(host);
  			case Accordant_dvPackage.DEVICE__TYPE:
  				return type != TYPE_EDEFAULT;
  			case Accordant_dvPackage.DEVICE__CPU:
  				return cpu != CPU_EDEFAULT;
  			case Accordant_dvPackage.DEVICE__STORAGE:
  				return storage != STORAGE_EDEFAULT;
  			case Accordant_dvPackage.DEVICE__MEM:
  				return mem != MEM_EDEFAULT;
  			case Accordant_dvPackage.DEVICE__NAME:
  				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
  			case Accordant_dvPackage.DEVICE__OS:
  				return OS_EDEFAULT == null ? os != null : !OS_EDEFAULT.equals(os);
  			case Accordant_dvPackage.DEVICE__PODS:
  				return pods != null && !pods.isEmpty();
  			case Accordant_dvPackage.DEVICE__DV:
  				return getDv() != null;
  		}
  		return super.eIsSet(featureID);
  	}
  
  	/**
  	 * <!-- begin-user-doc -->
  	 * <!-- end-user-doc -->
  	 * @generated
  	 */
  	@Override
  	public String toString() {
  		if (eIsProxy()) return super.toString();
  
  		StringBuilder result = new StringBuilder(super.toString());
  		result.append(" (host: ");
  		result.append(host);
  		result.append(", type: ");
  		result.append(type);
  		result.append(", cpu: ");
  		result.append(cpu);
  		result.append(", storage: ");
  		result.append(storage);
  		result.append(", mem: ");
  		result.append(mem);
  		result.append(", name: ");
  		result.append(name);
  		result.append(", os: ");
  		result.append(os);
  		result.append(')');
  		return result.toString();
  	}
  
  } //DeviceImpl
  