/**
*/
package org.eclipse.papyrus.RobotML.impl;
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.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.papyrus.RobotML.Environment;
import org.eclipse.papyrus.RobotML.PhysicalObject;
import org.eclipse.papyrus.RobotML.RobotMLPackage;
import org.eclipse.papyrus.RobotML.Surface;
/**
*
* An implementation of the model object 'Physical Object'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.papyrus.RobotML.impl.PhysicalObjectImpl#getEvelovesIn Eveloves In}
* - {@link org.eclipse.papyrus.RobotML.impl.PhysicalObjectImpl#getHasSurface Has Surface}
* - {@link org.eclipse.papyrus.RobotML.impl.PhysicalObjectImpl#getHeight Height}
* - {@link org.eclipse.papyrus.RobotML.impl.PhysicalObjectImpl#getMass Mass}
*
*
*
* @generated
*/
public class PhysicalObjectImpl extends SystemImpl implements PhysicalObject {
/**
* The cached value of the '{@link #getEvelovesIn() Eveloves In}' reference list.
*
*
*
* @see #getEvelovesIn()
* @generated
* @ordered
*/
protected EList evelovesIn;
/**
* The cached value of the '{@link #getHasSurface() Has Surface}' reference.
*
*
*
* @see #getHasSurface()
* @generated
* @ordered
*/
protected Surface hasSurface;
/**
* The default value of the '{@link #getHeight() Height}' attribute.
*
*
*
* @see #getHeight()
* @generated
* @ordered
*/
protected static final float HEIGHT_EDEFAULT = 0.0F;
/**
* The cached value of the '{@link #getHeight() Height}' attribute.
*
*
*
* @see #getHeight()
* @generated
* @ordered
*/
protected float height = HEIGHT_EDEFAULT;
/**
* The default value of the '{@link #getMass() Mass}' attribute.
*
*
*
* @see #getMass()
* @generated
* @ordered
*/
protected static final float MASS_EDEFAULT = 0.0F;
/**
* The cached value of the '{@link #getMass() Mass}' attribute.
*
*
*
* @see #getMass()
* @generated
* @ordered
*/
protected float mass = MASS_EDEFAULT;
/**
*
*
*
* @generated
*/
protected PhysicalObjectImpl() {
super();
}
/**
*
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return RobotMLPackage.Literals.PHYSICAL_OBJECT;
}
/**
*
*
*
* @generated
*/
public EList getEvelovesIn() {
if (evelovesIn == null) {
evelovesIn = new EObjectResolvingEList(Environment.class, this, RobotMLPackage.PHYSICAL_OBJECT__EVELOVES_IN);
}
return evelovesIn;
}
/**
*
*
*
* @generated
*/
public Surface getHasSurface() {
if (hasSurface != null && hasSurface.eIsProxy()) {
InternalEObject oldHasSurface = (InternalEObject) hasSurface;
hasSurface = (Surface) eResolveProxy(oldHasSurface);
if (hasSurface != oldHasSurface) {
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.RESOLVE, RobotMLPackage.PHYSICAL_OBJECT__HAS_SURFACE, oldHasSurface, hasSurface));
}
}
}
return hasSurface;
}
/**
*
*
*
* @generated
*/
public Surface basicGetHasSurface() {
return hasSurface;
}
/**
*
*
*
* @generated
*/
public void setHasSurface(Surface newHasSurface) {
Surface oldHasSurface = hasSurface;
hasSurface = newHasSurface;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, RobotMLPackage.PHYSICAL_OBJECT__HAS_SURFACE, oldHasSurface, hasSurface));
}
}
/**
*
*
*
* @generated
*/
public float getHeight() {
return height;
}
/**
*
*
*
* @generated
*/
public void setHeight(float newHeight) {
float oldHeight = height;
height = newHeight;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, RobotMLPackage.PHYSICAL_OBJECT__HEIGHT, oldHeight, height));
}
}
/**
*
*
*
* @generated
*/
public float getMass() {
return mass;
}
/**
*
*
*
* @generated
*/
public void setMass(float newMass) {
float oldMass = mass;
mass = newMass;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, RobotMLPackage.PHYSICAL_OBJECT__MASS, oldMass, mass));
}
}
/**
*
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case RobotMLPackage.PHYSICAL_OBJECT__EVELOVES_IN:
return getEvelovesIn();
case RobotMLPackage.PHYSICAL_OBJECT__HAS_SURFACE:
if (resolve) {
return getHasSurface();
}
return basicGetHasSurface();
case RobotMLPackage.PHYSICAL_OBJECT__HEIGHT:
return getHeight();
case RobotMLPackage.PHYSICAL_OBJECT__MASS:
return getMass();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case RobotMLPackage.PHYSICAL_OBJECT__EVELOVES_IN:
getEvelovesIn().clear();
getEvelovesIn().addAll((Collection extends Environment>) newValue);
return;
case RobotMLPackage.PHYSICAL_OBJECT__HAS_SURFACE:
setHasSurface((Surface) newValue);
return;
case RobotMLPackage.PHYSICAL_OBJECT__HEIGHT:
setHeight((Float) newValue);
return;
case RobotMLPackage.PHYSICAL_OBJECT__MASS:
setMass((Float) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case RobotMLPackage.PHYSICAL_OBJECT__EVELOVES_IN:
getEvelovesIn().clear();
return;
case RobotMLPackage.PHYSICAL_OBJECT__HAS_SURFACE:
setHasSurface((Surface) null);
return;
case RobotMLPackage.PHYSICAL_OBJECT__HEIGHT:
setHeight(HEIGHT_EDEFAULT);
return;
case RobotMLPackage.PHYSICAL_OBJECT__MASS:
setMass(MASS_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case RobotMLPackage.PHYSICAL_OBJECT__EVELOVES_IN:
return evelovesIn != null && !evelovesIn.isEmpty();
case RobotMLPackage.PHYSICAL_OBJECT__HAS_SURFACE:
return hasSurface != null;
case RobotMLPackage.PHYSICAL_OBJECT__HEIGHT:
return height != HEIGHT_EDEFAULT;
case RobotMLPackage.PHYSICAL_OBJECT__MASS:
return mass != MASS_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
*
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) {
return super.toString();
}
StringBuffer result = new StringBuffer(super.toString());
result.append(" (height: ");
result.append(height);
result.append(", mass: ");
result.append(mass);
result.append(')');
return result.toString();
}
} // PhysicalObjectImpl