blob: 584149e239c46cbc91ad6aa774fb93b6c39dc26d [file] [log] [blame]
/**
*
* Copyright (c) 2009 Hatha Systems.
* 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:
* Nikolai Mansourov (Hatha Systems) - initial API and implementation
* Gabriel Barbier (Mia-Software) - minor evolutions for version 1.1
*
* $Id$
*/
package org.eclipse.gmt.modisco.omg.kdm.code.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.gmt.modisco.omg.kdm.code.ClassUnit;
import org.eclipse.gmt.modisco.omg.kdm.code.CodeItem;
import org.eclipse.gmt.modisco.omg.kdm.code.CodePackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Class Unit</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.code.impl.ClassUnitImpl#getIsAbstract <em>Is Abstract</em>}</li>
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.code.impl.ClassUnitImpl#getCodeElement <em>Code Element</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ClassUnitImpl extends DatatypeImpl implements ClassUnit {
/**
* The default value of the '{@link #getIsAbstract() <em>Is Abstract</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIsAbstract()
* @generated
* @ordered
*/
protected static final Boolean IS_ABSTRACT_EDEFAULT = null;
/**
* The cached value of the '{@link #getIsAbstract() <em>Is Abstract</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIsAbstract()
* @generated
* @ordered
*/
protected Boolean isAbstract = IS_ABSTRACT_EDEFAULT;
/**
* The cached value of the '{@link #getCodeElement() <em>Code Element</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCodeElement()
* @generated
* @ordered
*/
protected EList<CodeItem> codeElement;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ClassUnitImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CodePackage.Literals.CLASS_UNIT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Boolean getIsAbstract() {
return isAbstract;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsAbstract(Boolean newIsAbstract) {
Boolean oldIsAbstract = isAbstract;
isAbstract = newIsAbstract;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CodePackage.CLASS_UNIT__IS_ABSTRACT, oldIsAbstract, isAbstract));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<CodeItem> getCodeElement() {
if (codeElement == null) {
codeElement = new EObjectContainmentEList<CodeItem>(CodeItem.class, this, CodePackage.CLASS_UNIT__CODE_ELEMENT);
}
return codeElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CodePackage.CLASS_UNIT__CODE_ELEMENT:
return ((InternalEList<?>)getCodeElement()).basicRemove(otherEnd, 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 CodePackage.CLASS_UNIT__IS_ABSTRACT:
return getIsAbstract();
case CodePackage.CLASS_UNIT__CODE_ELEMENT:
return getCodeElement();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case CodePackage.CLASS_UNIT__IS_ABSTRACT:
setIsAbstract((Boolean)newValue);
return;
case CodePackage.CLASS_UNIT__CODE_ELEMENT:
getCodeElement().clear();
getCodeElement().addAll((Collection<? extends CodeItem>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CodePackage.CLASS_UNIT__IS_ABSTRACT:
setIsAbstract(IS_ABSTRACT_EDEFAULT);
return;
case CodePackage.CLASS_UNIT__CODE_ELEMENT:
getCodeElement().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CodePackage.CLASS_UNIT__IS_ABSTRACT:
return IS_ABSTRACT_EDEFAULT == null ? isAbstract != null : !IS_ABSTRACT_EDEFAULT.equals(isAbstract);
case CodePackage.CLASS_UNIT__CODE_ELEMENT:
return codeElement != null && !codeElement.isEmpty();
}
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(" (isAbstract: "); //$NON-NLS-1$
result.append(isAbstract);
result.append(')');
return result.toString();
}
} //ClassUnitImpl