/**
*/
package simpleScenario.impl;
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;
import simpleScenario.Actor;
import simpleScenario.Lane;
import simpleScenario.SimpleScenario;
import simpleScenario.SimpleScenarioPackage;
/**
*
* An implementation of the model object 'Simple Scenario'.
*
*
* The following features are implemented:
*
*
* - {@link simpleScenario.impl.SimpleScenarioImpl#getXSize XSize}
* - {@link simpleScenario.impl.SimpleScenarioImpl#getYSize YSize}
* - {@link simpleScenario.impl.SimpleScenarioImpl#getActors Actors}
* - {@link simpleScenario.impl.SimpleScenarioImpl#getLanes Lanes}
*
*
* @generated
*/
public class SimpleScenarioImpl extends MinimalEObjectImpl.Container implements SimpleScenario {
/**
* The default value of the '{@link #getXSize() XSize}' attribute.
*
*
* @see #getXSize()
* @generated
* @ordered
*/
protected static final double XSIZE_EDEFAULT = 0.0;
/**
* The cached value of the '{@link #getXSize() XSize}' attribute.
*
*
* @see #getXSize()
* @generated
* @ordered
*/
protected double xSize = XSIZE_EDEFAULT;
/**
* The default value of the '{@link #getYSize() YSize}' attribute.
*
*
* @see #getYSize()
* @generated
* @ordered
*/
protected static final double YSIZE_EDEFAULT = 0.0;
/**
* The cached value of the '{@link #getYSize() YSize}' attribute.
*
*
* @see #getYSize()
* @generated
* @ordered
*/
protected double ySize = YSIZE_EDEFAULT;
/**
* The cached value of the '{@link #getActors() Actors}' containment reference list.
*
*
* @see #getActors()
* @generated
* @ordered
*/
protected EList actors;
/**
* The cached value of the '{@link #getLanes() Lanes}' containment reference list.
*
*
* @see #getLanes()
* @generated
* @ordered
*/
protected EList lanes;
/**
*
*
* @generated
*/
protected SimpleScenarioImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return SimpleScenarioPackage.Literals.SIMPLE_SCENARIO;
}
/**
*
*
* @generated
*/
@Override
public double getXSize() {
return xSize;
}
/**
*
*
* @generated
*/
@Override
public void setXSize(double newXSize) {
double oldXSize = xSize;
xSize = newXSize;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SimpleScenarioPackage.SIMPLE_SCENARIO__XSIZE, oldXSize, xSize));
}
/**
*
*
* @generated
*/
@Override
public double getYSize() {
return ySize;
}
/**
*
*
* @generated
*/
@Override
public void setYSize(double newYSize) {
double oldYSize = ySize;
ySize = newYSize;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SimpleScenarioPackage.SIMPLE_SCENARIO__YSIZE, oldYSize, ySize));
}
/**
*
*
* @generated
*/
@Override
public EList getActors() {
if (actors == null) {
actors = new EObjectContainmentEList(Actor.class, this, SimpleScenarioPackage.SIMPLE_SCENARIO__ACTORS);
}
return actors;
}
/**
*
*
* @generated
*/
@Override
public EList getLanes() {
if (lanes == null) {
lanes = new EObjectContainmentEList(Lane.class, this, SimpleScenarioPackage.SIMPLE_SCENARIO__LANES);
}
return lanes;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SimpleScenarioPackage.SIMPLE_SCENARIO__ACTORS:
return ((InternalEList>)getActors()).basicRemove(otherEnd, msgs);
case SimpleScenarioPackage.SIMPLE_SCENARIO__LANES:
return ((InternalEList>)getLanes()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case SimpleScenarioPackage.SIMPLE_SCENARIO__XSIZE:
return getXSize();
case SimpleScenarioPackage.SIMPLE_SCENARIO__YSIZE:
return getYSize();
case SimpleScenarioPackage.SIMPLE_SCENARIO__ACTORS:
return getActors();
case SimpleScenarioPackage.SIMPLE_SCENARIO__LANES:
return getLanes();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case SimpleScenarioPackage.SIMPLE_SCENARIO__XSIZE:
setXSize((Double)newValue);
return;
case SimpleScenarioPackage.SIMPLE_SCENARIO__YSIZE:
setYSize((Double)newValue);
return;
case SimpleScenarioPackage.SIMPLE_SCENARIO__ACTORS:
getActors().clear();
getActors().addAll((Collection extends Actor>)newValue);
return;
case SimpleScenarioPackage.SIMPLE_SCENARIO__LANES:
getLanes().clear();
getLanes().addAll((Collection extends Lane>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case SimpleScenarioPackage.SIMPLE_SCENARIO__XSIZE:
setXSize(XSIZE_EDEFAULT);
return;
case SimpleScenarioPackage.SIMPLE_SCENARIO__YSIZE:
setYSize(YSIZE_EDEFAULT);
return;
case SimpleScenarioPackage.SIMPLE_SCENARIO__ACTORS:
getActors().clear();
return;
case SimpleScenarioPackage.SIMPLE_SCENARIO__LANES:
getLanes().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SimpleScenarioPackage.SIMPLE_SCENARIO__XSIZE:
return xSize != XSIZE_EDEFAULT;
case SimpleScenarioPackage.SIMPLE_SCENARIO__YSIZE:
return ySize != YSIZE_EDEFAULT;
case SimpleScenarioPackage.SIMPLE_SCENARIO__ACTORS:
return actors != null && !actors.isEmpty();
case SimpleScenarioPackage.SIMPLE_SCENARIO__LANES:
return lanes != null && !lanes.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (xSize: ");
result.append(xSize);
result.append(", ySize: ");
result.append(ySize);
result.append(')');
return result.toString();
}
} //SimpleScenarioImpl