blob: 8ea2b20bc158ebf54df70e0a12e922d5080c37d9 [file] [log] [blame]
/**
* <copyright>
* Copyright (c) 2009, 2010 Open Canarias, S.L.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Adolfo Sanchez-Barbudo Herrera - Initial API and implementation
*
* </copyright>
*/
package org.eclipse.modisco.omg.gastm.impl;
import java.lang.Boolean;
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 org.eclipse.modisco.omg.gastm.DataDefinition;
import org.eclipse.modisco.omg.gastm.Expression;
import org.eclipse.modisco.omg.gastm.GASTMPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Data Definition</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.modisco.omg.gastm.impl.DataDefinitionImpl#getInitialValue <em>Initial Value</em>}</li>
* <li>{@link org.eclipse.modisco.omg.gastm.impl.DataDefinitionImpl#getIsMutable <em>Is Mutable</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class DataDefinitionImpl extends DefinitionImpl implements DataDefinition {
/**
* The cached value of the '{@link #getInitialValue() <em>Initial Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInitialValue()
* @generated
* @ordered
*/
protected Expression initialValue;
/**
* The default value of the '{@link #getIsMutable() <em>Is Mutable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIsMutable()
* @generated
* @ordered
*/
protected static final Boolean IS_MUTABLE_EDEFAULT = null;
/**
* The cached value of the '{@link #getIsMutable() <em>Is Mutable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIsMutable()
* @generated
* @ordered
*/
protected Boolean isMutable = IS_MUTABLE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DataDefinitionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return GASTMPackage.eINSTANCE.getDataDefinition();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getInitialValue() {
return initialValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetInitialValue(Expression newInitialValue, NotificationChain msgs) {
Expression oldInitialValue = initialValue;
initialValue = newInitialValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GASTMPackage.DATA_DEFINITION__INITIAL_VALUE, oldInitialValue, newInitialValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setInitialValue(Expression newInitialValue) {
if (newInitialValue != initialValue) {
NotificationChain msgs = null;
if (initialValue != null)
msgs = ((InternalEObject)initialValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GASTMPackage.DATA_DEFINITION__INITIAL_VALUE, null, msgs);
if (newInitialValue != null)
msgs = ((InternalEObject)newInitialValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GASTMPackage.DATA_DEFINITION__INITIAL_VALUE, null, msgs);
msgs = basicSetInitialValue(newInitialValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, GASTMPackage.DATA_DEFINITION__INITIAL_VALUE, newInitialValue, newInitialValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Boolean getIsMutable() {
return isMutable;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsMutable(Boolean newIsMutable) {
Boolean oldIsMutable = isMutable;
isMutable = newIsMutable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, GASTMPackage.DATA_DEFINITION__IS_MUTABLE, oldIsMutable, isMutable));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case GASTMPackage.DATA_DEFINITION__INITIAL_VALUE:
return basicSetInitialValue(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 GASTMPackage.DATA_DEFINITION__INITIAL_VALUE:
return getInitialValue();
case GASTMPackage.DATA_DEFINITION__IS_MUTABLE:
return getIsMutable();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case GASTMPackage.DATA_DEFINITION__INITIAL_VALUE:
setInitialValue((Expression)newValue);
return;
case GASTMPackage.DATA_DEFINITION__IS_MUTABLE:
setIsMutable((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case GASTMPackage.DATA_DEFINITION__INITIAL_VALUE:
setInitialValue((Expression)null);
return;
case GASTMPackage.DATA_DEFINITION__IS_MUTABLE:
setIsMutable(IS_MUTABLE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case GASTMPackage.DATA_DEFINITION__INITIAL_VALUE:
return initialValue != null;
case GASTMPackage.DATA_DEFINITION__IS_MUTABLE:
return IS_MUTABLE_EDEFAULT == null ? isMutable != null : !IS_MUTABLE_EDEFAULT.equals(isMutable);
}
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(" (isMutable: "); //$NON-NLS-1$
result.append(isMutable);
result.append(')');
return result.toString();
}
} //DataDefinitionImpl