/**
*/
package com.robotoworks.mechanoid.net.netModel.impl;
import com.robotoworks.mechanoid.net.netModel.Client;
import com.robotoworks.mechanoid.net.netModel.ClientBlock;
import com.robotoworks.mechanoid.net.netModel.NetModelPackage;
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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Client</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link com.robotoworks.mechanoid.net.netModel.impl.ClientImpl#getBaseUrl <em>Base Url</em>}</li>
* <li>{@link com.robotoworks.mechanoid.net.netModel.impl.ClientImpl#getBlocks <em>Blocks</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ClientImpl extends DeclarationImpl implements Client
{
/**
* The default value of the '{@link #getBaseUrl() <em>Base Url</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBaseUrl()
* @generated
* @ordered
*/
protected static final String BASE_URL_EDEFAULT = null;
/**
* The cached value of the '{@link #getBaseUrl() <em>Base Url</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBaseUrl()
* @generated
* @ordered
*/
protected String baseUrl = BASE_URL_EDEFAULT;
/**
* The cached value of the '{@link #getBlocks() <em>Blocks</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBlocks()
* @generated
* @ordered
*/
protected EList<ClientBlock> blocks;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ClientImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return NetModelPackage.Literals.CLIENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getBaseUrl()
{
return baseUrl;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBaseUrl(String newBaseUrl)
{
String oldBaseUrl = baseUrl;
baseUrl = newBaseUrl;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, NetModelPackage.CLIENT__BASE_URL, oldBaseUrl, baseUrl));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<ClientBlock> getBlocks()
{
if (blocks == null)
{
blocks = new EObjectContainmentEList<ClientBlock>(ClientBlock.class, this, NetModelPackage.CLIENT__BLOCKS);
}
return blocks;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case NetModelPackage.CLIENT__BLOCKS:
return ((InternalEList<?>)getBlocks()).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 NetModelPackage.CLIENT__BASE_URL:
return getBaseUrl();
case NetModelPackage.CLIENT__BLOCKS:
return getBlocks();
}
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 NetModelPackage.CLIENT__BASE_URL:
setBaseUrl((String)newValue);
return;
case NetModelPackage.CLIENT__BLOCKS:
getBlocks().clear();
getBlocks().addAll((Collection<? extends ClientBlock>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case NetModelPackage.CLIENT__BASE_URL:
setBaseUrl(BASE_URL_EDEFAULT);
return;
case NetModelPackage.CLIENT__BLOCKS:
getBlocks().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case NetModelPackage.CLIENT__BASE_URL:
return BASE_URL_EDEFAULT == null ? baseUrl != null : !BASE_URL_EDEFAULT.equals(baseUrl);
case NetModelPackage.CLIENT__BLOCKS:
return blocks != null && !blocks.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(" (baseUrl: ");
result.append(baseUrl);
result.append(')');
return result.toString();
}
} //ClientImpl