/**
* <copyright>
* </copyright>
*
* $Id$
*/
package OntoUML.impl;
import OntoUML.Feature;
import OntoUML.NamedElement;
import OntoUML.OntoUMLPackage;
import OntoUML.RedefinableElement;
import OntoUML.StructuralFeature;
import OntoUML.Type;
import OntoUML.TypedElement;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Structural Feature</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link OntoUML.impl.StructuralFeatureImpl#getName <em>Name</em>}</li>
* <li>{@link OntoUML.impl.StructuralFeatureImpl#isIsLeaf <em>Is Leaf</em>}</li>
* <li>{@link OntoUML.impl.StructuralFeatureImpl#isIsStatic <em>Is Static</em>}</li>
* <li>{@link OntoUML.impl.StructuralFeatureImpl#getType <em>Type</em>}</li>
* <li>{@link OntoUML.impl.StructuralFeatureImpl#isIsReadOnly <em>Is Read Only</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class StructuralFeatureImpl extends MultiplicityElementImpl implements StructuralFeature {
/**
* 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 default value of the '{@link #isIsLeaf() <em>Is Leaf</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsLeaf()
* @generated
* @ordered
*/
protected static final boolean IS_LEAF_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsLeaf() <em>Is Leaf</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsLeaf()
* @generated
* @ordered
*/
protected boolean isLeaf = IS_LEAF_EDEFAULT;
/**
* The default value of the '{@link #isIsStatic() <em>Is Static</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsStatic()
* @generated
* @ordered
*/
protected static final boolean IS_STATIC_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsStatic() <em>Is Static</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsStatic()
* @generated
* @ordered
*/
protected boolean isStatic = IS_STATIC_EDEFAULT;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected Type type;
/**
* The default value of the '{@link #isIsReadOnly() <em>Is Read Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsReadOnly()
* @generated
* @ordered
*/
protected static final boolean IS_READ_ONLY_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsReadOnly() <em>Is Read Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsReadOnly()
* @generated
* @ordered
*/
protected boolean isReadOnly = IS_READ_ONLY_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected StructuralFeatureImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return OntoUMLPackage.Literals.STRUCTURAL_FEATURE;
}
/**
* <!-- 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, OntoUMLPackage.STRUCTURAL_FEATURE__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isIsLeaf() {
return isLeaf;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsLeaf(boolean newIsLeaf) {
boolean oldIsLeaf = isLeaf;
isLeaf = newIsLeaf;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OntoUMLPackage.STRUCTURAL_FEATURE__IS_LEAF, oldIsLeaf, isLeaf));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isIsStatic() {
return isStatic;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsStatic(boolean newIsStatic) {
boolean oldIsStatic = isStatic;
isStatic = newIsStatic;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OntoUMLPackage.STRUCTURAL_FEATURE__IS_STATIC, oldIsStatic, isStatic));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type getType() {
if (type != null && type.eIsProxy()) {
InternalEObject oldType = (InternalEObject)type;
type = (Type)eResolveProxy(oldType);
if (type != oldType) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, OntoUMLPackage.STRUCTURAL_FEATURE__TYPE, oldType, type));
}
}
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type basicGetType() {
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(Type newType) {
Type oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OntoUMLPackage.STRUCTURAL_FEATURE__TYPE, oldType, type));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isIsReadOnly() {
return isReadOnly;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsReadOnly(boolean newIsReadOnly) {
boolean oldIsReadOnly = isReadOnly;
isReadOnly = newIsReadOnly;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OntoUMLPackage.STRUCTURAL_FEATURE__IS_READ_ONLY, oldIsReadOnly, isReadOnly));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case OntoUMLPackage.STRUCTURAL_FEATURE__NAME:
return getName();
case OntoUMLPackage.STRUCTURAL_FEATURE__IS_LEAF:
return isIsLeaf() ? Boolean.TRUE : Boolean.FALSE;
case OntoUMLPackage.STRUCTURAL_FEATURE__IS_STATIC:
return isIsStatic() ? Boolean.TRUE : Boolean.FALSE;
case OntoUMLPackage.STRUCTURAL_FEATURE__TYPE:
if (resolve) return getType();
return basicGetType();
case OntoUMLPackage.STRUCTURAL_FEATURE__IS_READ_ONLY:
return isIsReadOnly() ? Boolean.TRUE : Boolean.FALSE;
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case OntoUMLPackage.STRUCTURAL_FEATURE__NAME:
setName((String)newValue);
return;
case OntoUMLPackage.STRUCTURAL_FEATURE__IS_LEAF:
setIsLeaf(((Boolean)newValue).booleanValue());
return;
case OntoUMLPackage.STRUCTURAL_FEATURE__IS_STATIC:
setIsStatic(((Boolean)newValue).booleanValue());
return;
case OntoUMLPackage.STRUCTURAL_FEATURE__TYPE:
setType((Type)newValue);
return;
case OntoUMLPackage.STRUCTURAL_FEATURE__IS_READ_ONLY:
setIsReadOnly(((Boolean)newValue).booleanValue());
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case OntoUMLPackage.STRUCTURAL_FEATURE__NAME:
setName(NAME_EDEFAULT);
return;
case OntoUMLPackage.STRUCTURAL_FEATURE__IS_LEAF:
setIsLeaf(IS_LEAF_EDEFAULT);
return;
case OntoUMLPackage.STRUCTURAL_FEATURE__IS_STATIC:
setIsStatic(IS_STATIC_EDEFAULT);
return;
case OntoUMLPackage.STRUCTURAL_FEATURE__TYPE:
setType((Type)null);
return;
case OntoUMLPackage.STRUCTURAL_FEATURE__IS_READ_ONLY:
setIsReadOnly(IS_READ_ONLY_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case OntoUMLPackage.STRUCTURAL_FEATURE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case OntoUMLPackage.STRUCTURAL_FEATURE__IS_LEAF:
return isLeaf != IS_LEAF_EDEFAULT;
case OntoUMLPackage.STRUCTURAL_FEATURE__IS_STATIC:
return isStatic != IS_STATIC_EDEFAULT;
case OntoUMLPackage.STRUCTURAL_FEATURE__TYPE:
return type != null;
case OntoUMLPackage.STRUCTURAL_FEATURE__IS_READ_ONLY:
return isReadOnly != IS_READ_ONLY_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == NamedElement.class) {
switch (derivedFeatureID) {
case OntoUMLPackage.STRUCTURAL_FEATURE__NAME: return OntoUMLPackage.NAMED_ELEMENT__NAME;
default: return -1;
}
}
if (baseClass == RedefinableElement.class) {
switch (derivedFeatureID) {
case OntoUMLPackage.STRUCTURAL_FEATURE__IS_LEAF: return OntoUMLPackage.REDEFINABLE_ELEMENT__IS_LEAF;
default: return -1;
}
}
if (baseClass == Feature.class) {
switch (derivedFeatureID) {
case OntoUMLPackage.STRUCTURAL_FEATURE__IS_STATIC: return OntoUMLPackage.FEATURE__IS_STATIC;
default: return -1;
}
}
if (baseClass == TypedElement.class) {
switch (derivedFeatureID) {
case OntoUMLPackage.STRUCTURAL_FEATURE__TYPE: return OntoUMLPackage.TYPED_ELEMENT__TYPE;
default: return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
if (baseClass == NamedElement.class) {
switch (baseFeatureID) {
case OntoUMLPackage.NAMED_ELEMENT__NAME: return OntoUMLPackage.STRUCTURAL_FEATURE__NAME;
default: return -1;
}
}
if (baseClass == RedefinableElement.class) {
switch (baseFeatureID) {
case OntoUMLPackage.REDEFINABLE_ELEMENT__IS_LEAF: return OntoUMLPackage.STRUCTURAL_FEATURE__IS_LEAF;
default: return -1;
}
}
if (baseClass == Feature.class) {
switch (baseFeatureID) {
case OntoUMLPackage.FEATURE__IS_STATIC: return OntoUMLPackage.STRUCTURAL_FEATURE__IS_STATIC;
default: return -1;
}
}
if (baseClass == TypedElement.class) {
switch (baseFeatureID) {
case OntoUMLPackage.TYPED_ELEMENT__TYPE: return OntoUMLPackage.STRUCTURAL_FEATURE__TYPE;
default: return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
* <!-- 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: ");
result.append(name);
result.append(", isLeaf: ");
result.append(isLeaf);
result.append(", isStatic: ");
result.append(isStatic);
result.append(", isReadOnly: ");
result.append(isReadOnly);
result.append(')');
return result.toString();
}
} //StructuralFeatureImpl