/**
* <copyright>
* </copyright>
*
* $Id$
*/
package orgomg.cwm.management.warehouseoperation.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import orgomg.cwm.management.warehouseoperation.Measurement;
import orgomg.cwm.management.warehouseoperation.WarehouseoperationPackage;
import orgomg.cwm.objectmodel.core.CorePackage;
import orgomg.cwm.objectmodel.core.ModelElement;
import orgomg.cwm.objectmodel.core.impl.ModelElementImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Measurement</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link orgomg.cwm.management.warehouseoperation.impl.MeasurementImpl#getValue <em>Value</em>}</li>
* <li>{@link orgomg.cwm.management.warehouseoperation.impl.MeasurementImpl#getUnit <em>Unit</em>}</li>
* <li>{@link orgomg.cwm.management.warehouseoperation.impl.MeasurementImpl#getType <em>Type</em>}</li>
* <li>{@link orgomg.cwm.management.warehouseoperation.impl.MeasurementImpl#getCreationDate <em>Creation Date</em>}</li>
* <li>{@link orgomg.cwm.management.warehouseoperation.impl.MeasurementImpl#getEffectiveDate <em>Effective Date</em>}</li>
* <li>{@link orgomg.cwm.management.warehouseoperation.impl.MeasurementImpl#getModelElement <em>Model Element</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class MeasurementImpl extends ModelElementImpl implements Measurement {
/**
* The default value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected static final String VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected String value = VALUE_EDEFAULT;
/**
* The default value of the '{@link #getUnit() <em>Unit</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUnit()
* @generated
* @ordered
*/
protected static final String UNIT_EDEFAULT = null;
/**
* The cached value of the '{@link #getUnit() <em>Unit</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUnit()
* @generated
* @ordered
*/
protected String unit = UNIT_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 String TYPE_EDEFAULT = null;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected String type = TYPE_EDEFAULT;
/**
* The default value of the '{@link #getCreationDate() <em>Creation Date</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCreationDate()
* @generated
* @ordered
*/
protected static final String CREATION_DATE_EDEFAULT = null;
/**
* The cached value of the '{@link #getCreationDate() <em>Creation Date</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCreationDate()
* @generated
* @ordered
*/
protected String creationDate = CREATION_DATE_EDEFAULT;
/**
* The default value of the '{@link #getEffectiveDate() <em>Effective Date</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEffectiveDate()
* @generated
* @ordered
*/
protected static final String EFFECTIVE_DATE_EDEFAULT = null;
/**
* The cached value of the '{@link #getEffectiveDate() <em>Effective Date</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEffectiveDate()
* @generated
* @ordered
*/
protected String effectiveDate = EFFECTIVE_DATE_EDEFAULT;
/**
* The cached value of the '{@link #getModelElement() <em>Model Element</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getModelElement()
* @generated
* @ordered
*/
protected ModelElement modelElement;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MeasurementImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return WarehouseoperationPackage.Literals.MEASUREMENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getValue() {
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setValue(String newValue) {
String oldValue = value;
value = newValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WarehouseoperationPackage.MEASUREMENT__VALUE, oldValue, value));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getUnit() {
return unit;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setUnit(String newUnit) {
String oldUnit = unit;
unit = newUnit;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WarehouseoperationPackage.MEASUREMENT__UNIT, oldUnit, unit));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getType() {
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(String newType) {
String oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WarehouseoperationPackage.MEASUREMENT__TYPE, oldType, type));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getCreationDate() {
return creationDate;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCreationDate(String newCreationDate) {
String oldCreationDate = creationDate;
creationDate = newCreationDate;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WarehouseoperationPackage.MEASUREMENT__CREATION_DATE, oldCreationDate, creationDate));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getEffectiveDate() {
return effectiveDate;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEffectiveDate(String newEffectiveDate) {
String oldEffectiveDate = effectiveDate;
effectiveDate = newEffectiveDate;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WarehouseoperationPackage.MEASUREMENT__EFFECTIVE_DATE, oldEffectiveDate, effectiveDate));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ModelElement getModelElement() {
if (modelElement != null && modelElement.eIsProxy()) {
InternalEObject oldModelElement = (InternalEObject)modelElement;
modelElement = (ModelElement)eResolveProxy(oldModelElement);
if (modelElement != oldModelElement) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, WarehouseoperationPackage.MEASUREMENT__MODEL_ELEMENT, oldModelElement, modelElement));
}
}
return modelElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ModelElement basicGetModelElement() {
return modelElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetModelElement(ModelElement newModelElement, NotificationChain msgs) {
ModelElement oldModelElement = modelElement;
modelElement = newModelElement;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, WarehouseoperationPackage.MEASUREMENT__MODEL_ELEMENT, oldModelElement, newModelElement);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setModelElement(ModelElement newModelElement) {
if (newModelElement != modelElement) {
NotificationChain msgs = null;
if (modelElement != null)
msgs = ((InternalEObject)modelElement).eInverseRemove(this, CorePackage.MODEL_ELEMENT__MEASUREMENT, ModelElement.class, msgs);
if (newModelElement != null)
msgs = ((InternalEObject)newModelElement).eInverseAdd(this, CorePackage.MODEL_ELEMENT__MEASUREMENT, ModelElement.class, msgs);
msgs = basicSetModelElement(newModelElement, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WarehouseoperationPackage.MEASUREMENT__MODEL_ELEMENT, newModelElement, newModelElement));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case WarehouseoperationPackage.MEASUREMENT__MODEL_ELEMENT:
if (modelElement != null)
msgs = ((InternalEObject)modelElement).eInverseRemove(this, CorePackage.MODEL_ELEMENT__MEASUREMENT, ModelElement.class, msgs);
return basicSetModelElement((ModelElement)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 WarehouseoperationPackage.MEASUREMENT__MODEL_ELEMENT:
return basicSetModelElement(null, 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 WarehouseoperationPackage.MEASUREMENT__VALUE:
return getValue();
case WarehouseoperationPackage.MEASUREMENT__UNIT:
return getUnit();
case WarehouseoperationPackage.MEASUREMENT__TYPE:
return getType();
case WarehouseoperationPackage.MEASUREMENT__CREATION_DATE:
return getCreationDate();
case WarehouseoperationPackage.MEASUREMENT__EFFECTIVE_DATE:
return getEffectiveDate();
case WarehouseoperationPackage.MEASUREMENT__MODEL_ELEMENT:
if (resolve) return getModelElement();
return basicGetModelElement();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case WarehouseoperationPackage.MEASUREMENT__VALUE:
setValue((String)newValue);
return;
case WarehouseoperationPackage.MEASUREMENT__UNIT:
setUnit((String)newValue);
return;
case WarehouseoperationPackage.MEASUREMENT__TYPE:
setType((String)newValue);
return;
case WarehouseoperationPackage.MEASUREMENT__CREATION_DATE:
setCreationDate((String)newValue);
return;
case WarehouseoperationPackage.MEASUREMENT__EFFECTIVE_DATE:
setEffectiveDate((String)newValue);
return;
case WarehouseoperationPackage.MEASUREMENT__MODEL_ELEMENT:
setModelElement((ModelElement)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case WarehouseoperationPackage.MEASUREMENT__VALUE:
setValue(VALUE_EDEFAULT);
return;
case WarehouseoperationPackage.MEASUREMENT__UNIT:
setUnit(UNIT_EDEFAULT);
return;
case WarehouseoperationPackage.MEASUREMENT__TYPE:
setType(TYPE_EDEFAULT);
return;
case WarehouseoperationPackage.MEASUREMENT__CREATION_DATE:
setCreationDate(CREATION_DATE_EDEFAULT);
return;
case WarehouseoperationPackage.MEASUREMENT__EFFECTIVE_DATE:
setEffectiveDate(EFFECTIVE_DATE_EDEFAULT);
return;
case WarehouseoperationPackage.MEASUREMENT__MODEL_ELEMENT:
setModelElement((ModelElement)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case WarehouseoperationPackage.MEASUREMENT__VALUE:
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
case WarehouseoperationPackage.MEASUREMENT__UNIT:
return UNIT_EDEFAULT == null ? unit != null : !UNIT_EDEFAULT.equals(unit);
case WarehouseoperationPackage.MEASUREMENT__TYPE:
return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
case WarehouseoperationPackage.MEASUREMENT__CREATION_DATE:
return CREATION_DATE_EDEFAULT == null ? creationDate != null : !CREATION_DATE_EDEFAULT.equals(creationDate);
case WarehouseoperationPackage.MEASUREMENT__EFFECTIVE_DATE:
return EFFECTIVE_DATE_EDEFAULT == null ? effectiveDate != null : !EFFECTIVE_DATE_EDEFAULT.equals(effectiveDate);
case WarehouseoperationPackage.MEASUREMENT__MODEL_ELEMENT:
return modelElement != null;
}
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(" (value: ");
result.append(value);
result.append(", unit: ");
result.append(unit);
result.append(", type: ");
result.append(type);
result.append(", creationDate: ");
result.append(creationDate);
result.append(", effectiveDate: ");
result.append(effectiveDate);
result.append(')');
return result.toString();
}
} //MeasurementImpl