blob: 082a210c75f2a11585ee6b5e389e740065c80efe [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2012-2014 SAP SE.
* 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:
* SAP SE - initial API and implementation and/or initial documentation
*
*******************************************************************************/
/**
*/
package org.eclipse.ogee.model.odata.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 org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.ogee.model.odata.Documentation;
import org.eclipse.ogee.model.odata.EnumMember;
import org.eclipse.ogee.model.odata.Int32Value;
import org.eclipse.ogee.model.odata.Int64Value;
import org.eclipse.ogee.model.odata.IntegerValue;
import org.eclipse.ogee.model.odata.OdataFactory;
import org.eclipse.ogee.model.odata.OdataPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Enum Member</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.ogee.model.odata.impl.EnumMemberImpl#getDocumentation <em>Documentation</em>}</li>
* <li>{@link org.eclipse.ogee.model.odata.impl.EnumMemberImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.ogee.model.odata.impl.EnumMemberImpl#getValue <em>Value</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class EnumMemberImpl extends EObjectImpl implements EnumMember {
/**
* The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDocumentation()
* @generated
* @ordered
*/
protected Documentation documentation;
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected IntegerValue value;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EnumMemberImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return OdataPackage.Literals.ENUM_MEMBER;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Documentation getDocumentation() {
return documentation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetDocumentation(Documentation newDocumentation, NotificationChain msgs) {
Documentation oldDocumentation = documentation;
documentation = newDocumentation;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OdataPackage.ENUM_MEMBER__DOCUMENTATION, oldDocumentation, newDocumentation);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDocumentation(Documentation newDocumentation) {
if (newDocumentation != documentation) {
NotificationChain msgs = null;
if (documentation != null)
msgs = ((InternalEObject)documentation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OdataPackage.ENUM_MEMBER__DOCUMENTATION, null, msgs);
if (newDocumentation != null)
msgs = ((InternalEObject)newDocumentation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OdataPackage.ENUM_MEMBER__DOCUMENTATION, null, msgs);
msgs = basicSetDocumentation(newDocumentation, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OdataPackage.ENUM_MEMBER__DOCUMENTATION, newDocumentation, newDocumentation));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OdataPackage.ENUM_MEMBER__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IntegerValue getValue() {
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetValue(IntegerValue newValue, NotificationChain msgs) {
IntegerValue oldValue = value;
value = newValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OdataPackage.ENUM_MEMBER__VALUE, oldValue, newValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setValue(IntegerValue newValue) {
if (newValue != value) {
NotificationChain msgs = null;
if (value != null)
msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OdataPackage.ENUM_MEMBER__VALUE, null, msgs);
if (newValue != null)
msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OdataPackage.ENUM_MEMBER__VALUE, null, msgs);
msgs = basicSetValue(newValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OdataPackage.ENUM_MEMBER__VALUE, newValue, newValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public void setValue(Integer value) {
Int32Value node = OdataFactory.eINSTANCE.createInt32Value();
node.setValue(value);
this.setValue(node);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public void setValue(Long value) {
Int64Value node = OdataFactory.eINSTANCE.createInt64Value();
node.setValue(value);
this.setValue(node);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case OdataPackage.ENUM_MEMBER__DOCUMENTATION:
return basicSetDocumentation(null, msgs);
case OdataPackage.ENUM_MEMBER__VALUE:
return basicSetValue(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 OdataPackage.ENUM_MEMBER__DOCUMENTATION:
return getDocumentation();
case OdataPackage.ENUM_MEMBER__NAME:
return getName();
case OdataPackage.ENUM_MEMBER__VALUE:
return getValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case OdataPackage.ENUM_MEMBER__DOCUMENTATION:
setDocumentation((Documentation)newValue);
return;
case OdataPackage.ENUM_MEMBER__NAME:
setName((String)newValue);
return;
case OdataPackage.ENUM_MEMBER__VALUE:
setValue((IntegerValue)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case OdataPackage.ENUM_MEMBER__DOCUMENTATION:
setDocumentation((Documentation)null);
return;
case OdataPackage.ENUM_MEMBER__NAME:
setName(NAME_EDEFAULT);
return;
case OdataPackage.ENUM_MEMBER__VALUE:
setValue((IntegerValue)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case OdataPackage.ENUM_MEMBER__DOCUMENTATION:
return documentation != null;
case OdataPackage.ENUM_MEMBER__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case OdataPackage.ENUM_MEMBER__VALUE:
return value != 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(" (name: "); //$NON-NLS-1$
result.append(name);
result.append(')');
return result.toString();
}
} //EnumMemberImpl