/**
* <copyright>
* </copyright>
*
* $Id$
*/
package ssl.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import ssl.ObserveVariableChange;
import ssl.SslPackage;
import ssl.UnitOfTime;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Observe Variable Change</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link ssl.impl.ObserveVariableChangeImpl#getVariableName <em>Variable Name</em>}</li>
* <li>{@link ssl.impl.ObserveVariableChangeImpl#getUnit <em>Unit</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ObserveVariableChangeImpl extends ObservationImpl implements ObserveVariableChange {
/**
* The default value of the '{@link #getVariableName() <em>Variable Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVariableName()
* @generated
* @ordered
*/
protected static final String VARIABLE_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getVariableName() <em>Variable Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVariableName()
* @generated
* @ordered
*/
protected String variableName = VARIABLE_NAME_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 UnitOfTime UNIT_EDEFAULT = UnitOfTime.HOUR;
/**
* The cached value of the '{@link #getUnit() <em>Unit</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUnit()
* @generated
* @ordered
*/
protected UnitOfTime unit = UNIT_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ObserveVariableChangeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return SslPackage.Literals.OBSERVE_VARIABLE_CHANGE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getVariableName() {
return variableName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setVariableName(String newVariableName) {
String oldVariableName = variableName;
variableName = newVariableName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SslPackage.OBSERVE_VARIABLE_CHANGE__VARIABLE_NAME, oldVariableName, variableName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public UnitOfTime getUnit() {
return unit;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setUnit(UnitOfTime newUnit) {
UnitOfTime oldUnit = unit;
unit = newUnit == null ? UNIT_EDEFAULT : newUnit;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SslPackage.OBSERVE_VARIABLE_CHANGE__UNIT, oldUnit, unit));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case SslPackage.OBSERVE_VARIABLE_CHANGE__VARIABLE_NAME:
return getVariableName();
case SslPackage.OBSERVE_VARIABLE_CHANGE__UNIT:
return getUnit();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case SslPackage.OBSERVE_VARIABLE_CHANGE__VARIABLE_NAME:
setVariableName((String)newValue);
return;
case SslPackage.OBSERVE_VARIABLE_CHANGE__UNIT:
setUnit((UnitOfTime)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case SslPackage.OBSERVE_VARIABLE_CHANGE__VARIABLE_NAME:
setVariableName(VARIABLE_NAME_EDEFAULT);
return;
case SslPackage.OBSERVE_VARIABLE_CHANGE__UNIT:
setUnit(UNIT_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SslPackage.OBSERVE_VARIABLE_CHANGE__VARIABLE_NAME:
return VARIABLE_NAME_EDEFAULT == null ? variableName != null : !VARIABLE_NAME_EDEFAULT.equals(variableName);
case SslPackage.OBSERVE_VARIABLE_CHANGE__UNIT:
return unit != UNIT_EDEFAULT;
}
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(" (variableName: ");
result.append(variableName);
result.append(", unit: ");
result.append(unit);
result.append(')');
return result.toString();
}
} //ObserveVariableChangeImpl