/**
*/
package crossingScenario.impl;
import crossingScenario.Actor;
import crossingScenario.CrossingScenarioPackage;
import crossingScenario.Lane;
import crossingScenario.Orientation;
import crossingScenario.Size;
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.InternalEList;
/**
*
* An implementation of the model object 'Lane'.
*
*
* The following features are implemented:
*
*
* - {@link crossingScenario.impl.LaneImpl#getOrientation Orientation}
* - {@link crossingScenario.impl.LaneImpl#getWidth Width}
* - {@link crossingScenario.impl.LaneImpl#getReferenceCoord Reference Coord}
* - {@link crossingScenario.impl.LaneImpl#getPrevLane Prev Lane}
* - {@link crossingScenario.impl.LaneImpl#getActors Actors}
* - {@link crossingScenario.impl.LaneImpl#getNumWidth Num Width}
*
*
* @generated
*/
public class LaneImpl extends MinimalEObjectImpl.Container implements Lane {
/**
* The default value of the '{@link #getOrientation() Orientation}' attribute.
*
*
* @see #getOrientation()
* @generated
* @ordered
*/
protected static final Orientation ORIENTATION_EDEFAULT = Orientation.VERTICAL;
/**
* The cached value of the '{@link #getOrientation() Orientation}' attribute.
*
*
* @see #getOrientation()
* @generated
* @ordered
*/
protected Orientation orientation = ORIENTATION_EDEFAULT;
/**
* The default value of the '{@link #getWidth() Width}' attribute.
*
*
* @see #getWidth()
* @generated
* @ordered
*/
protected static final Size WIDTH_EDEFAULT = Size.SMALL;
/**
* The cached value of the '{@link #getWidth() Width}' attribute.
*
*
* @see #getWidth()
* @generated
* @ordered
*/
protected Size width = WIDTH_EDEFAULT;
/**
* The default value of the '{@link #getReferenceCoord() Reference Coord}' attribute.
*
*
* @see #getReferenceCoord()
* @generated
* @ordered
*/
protected static final double REFERENCE_COORD_EDEFAULT = 0.0;
/**
* The cached value of the '{@link #getReferenceCoord() Reference Coord}' attribute.
*
*
* @see #getReferenceCoord()
* @generated
* @ordered
*/
protected double referenceCoord = REFERENCE_COORD_EDEFAULT;
/**
* The cached value of the '{@link #getPrevLane() Prev Lane}' reference.
*
*
* @see #getPrevLane()
* @generated
* @ordered
*/
protected Lane prevLane;
/**
* The cached value of the '{@link #getActors() Actors}' reference list.
*
*
* @see #getActors()
* @generated
* @ordered
*/
protected EList actors;
/**
* The default value of the '{@link #getNumWidth() Num Width}' attribute.
*
*
* @see #getNumWidth()
* @generated
* @ordered
*/
protected static final double NUM_WIDTH_EDEFAULT = 0.0;
/**
* The cached value of the '{@link #getNumWidth() Num Width}' attribute.
*
*
* @see #getNumWidth()
* @generated
* @ordered
*/
protected double numWidth = NUM_WIDTH_EDEFAULT;
/**
*
*
* @generated
*/
protected LaneImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return CrossingScenarioPackage.Literals.LANE;
}
/**
*
*
* @generated
*/
@Override
public Orientation getOrientation() {
return orientation;
}
/**
*
*
* @generated
*/
@Override
public void setOrientation(Orientation newOrientation) {
Orientation oldOrientation = orientation;
orientation = newOrientation == null ? ORIENTATION_EDEFAULT : newOrientation;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CrossingScenarioPackage.LANE__ORIENTATION, oldOrientation, orientation));
}
/**
*
*
* @generated
*/
@Override
public Size getWidth() {
return width;
}
/**
*
*
* @generated
*/
@Override
public void setWidth(Size newWidth) {
Size oldWidth = width;
width = newWidth == null ? WIDTH_EDEFAULT : newWidth;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CrossingScenarioPackage.LANE__WIDTH, oldWidth, width));
}
/**
*
*
* @generated
*/
@Override
public double getReferenceCoord() {
return referenceCoord;
}
/**
*
*
* @generated
*/
@Override
public void setReferenceCoord(double newReferenceCoord) {
double oldReferenceCoord = referenceCoord;
referenceCoord = newReferenceCoord;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CrossingScenarioPackage.LANE__REFERENCE_COORD, oldReferenceCoord, referenceCoord));
}
/**
*
*
* @generated
*/
@Override
public Lane getPrevLane() {
if (prevLane != null && prevLane.eIsProxy()) {
InternalEObject oldPrevLane = (InternalEObject)prevLane;
prevLane = (Lane)eResolveProxy(oldPrevLane);
if (prevLane != oldPrevLane) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, CrossingScenarioPackage.LANE__PREV_LANE, oldPrevLane, prevLane));
}
}
return prevLane;
}
/**
*
*
* @generated
*/
public Lane basicGetPrevLane() {
return prevLane;
}
/**
*
*
* @generated
*/
@Override
public void setPrevLane(Lane newPrevLane) {
Lane oldPrevLane = prevLane;
prevLane = newPrevLane;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CrossingScenarioPackage.LANE__PREV_LANE, oldPrevLane, prevLane));
}
/**
*
*
* @generated
*/
@Override
public EList getActors() {
if (actors == null) {
actors = new EObjectWithInverseResolvingEList(Actor.class, this, CrossingScenarioPackage.LANE__ACTORS, CrossingScenarioPackage.ACTOR__PLACED_ON);
}
return actors;
}
/**
*
*
* @generated
*/
@Override
public double getNumWidth() {
return numWidth;
}
/**
*
*
* @generated
*/
@Override
public void setNumWidth(double newNumWidth) {
double oldNumWidth = numWidth;
numWidth = newNumWidth;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CrossingScenarioPackage.LANE__NUM_WIDTH, oldNumWidth, numWidth));
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CrossingScenarioPackage.LANE__ACTORS:
return ((InternalEList)(InternalEList>)getActors()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CrossingScenarioPackage.LANE__ACTORS:
return ((InternalEList>)getActors()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case CrossingScenarioPackage.LANE__ORIENTATION:
return getOrientation();
case CrossingScenarioPackage.LANE__WIDTH:
return getWidth();
case CrossingScenarioPackage.LANE__REFERENCE_COORD:
return getReferenceCoord();
case CrossingScenarioPackage.LANE__PREV_LANE:
if (resolve) return getPrevLane();
return basicGetPrevLane();
case CrossingScenarioPackage.LANE__ACTORS:
return getActors();
case CrossingScenarioPackage.LANE__NUM_WIDTH:
return getNumWidth();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case CrossingScenarioPackage.LANE__ORIENTATION:
setOrientation((Orientation)newValue);
return;
case CrossingScenarioPackage.LANE__WIDTH:
setWidth((Size)newValue);
return;
case CrossingScenarioPackage.LANE__REFERENCE_COORD:
setReferenceCoord((Double)newValue);
return;
case CrossingScenarioPackage.LANE__PREV_LANE:
setPrevLane((Lane)newValue);
return;
case CrossingScenarioPackage.LANE__ACTORS:
getActors().clear();
getActors().addAll((Collection extends Actor>)newValue);
return;
case CrossingScenarioPackage.LANE__NUM_WIDTH:
setNumWidth((Double)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CrossingScenarioPackage.LANE__ORIENTATION:
setOrientation(ORIENTATION_EDEFAULT);
return;
case CrossingScenarioPackage.LANE__WIDTH:
setWidth(WIDTH_EDEFAULT);
return;
case CrossingScenarioPackage.LANE__REFERENCE_COORD:
setReferenceCoord(REFERENCE_COORD_EDEFAULT);
return;
case CrossingScenarioPackage.LANE__PREV_LANE:
setPrevLane((Lane)null);
return;
case CrossingScenarioPackage.LANE__ACTORS:
getActors().clear();
return;
case CrossingScenarioPackage.LANE__NUM_WIDTH:
setNumWidth(NUM_WIDTH_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CrossingScenarioPackage.LANE__ORIENTATION:
return orientation != ORIENTATION_EDEFAULT;
case CrossingScenarioPackage.LANE__WIDTH:
return width != WIDTH_EDEFAULT;
case CrossingScenarioPackage.LANE__REFERENCE_COORD:
return referenceCoord != REFERENCE_COORD_EDEFAULT;
case CrossingScenarioPackage.LANE__PREV_LANE:
return prevLane != null;
case CrossingScenarioPackage.LANE__ACTORS:
return actors != null && !actors.isEmpty();
case CrossingScenarioPackage.LANE__NUM_WIDTH:
return numWidth != NUM_WIDTH_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (orientation: ");
result.append(orientation);
result.append(", width: ");
result.append(width);
result.append(", referenceCoord: ");
result.append(referenceCoord);
result.append(", numWidth: ");
result.append(numWidth);
result.append(')');
return result.toString();
}
} //LaneImpl