/** | |
* ******************************************************************************* | |
* Copyright (c) 2008 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 | |
* ******************************************************************************* | |
* | |
* $Id$ | |
*/ | |
package org.eclipse.gmt.modisco.omg.kdm.build.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.build.BuildDescription; | |
import org.eclipse.gmt.modisco.omg.kdm.build.BuildPackage; | |
import org.eclipse.gmt.modisco.omg.kdm.source.SourceRef; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Description</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.build.impl.BuildDescriptionImpl#getSource <em>Source</em>}</li> | |
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.build.impl.BuildDescriptionImpl#getText <em>Text</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class BuildDescriptionImpl extends BuildResourceImpl implements BuildDescription { | |
/** | |
* The cached value of the '{@link #getSource() <em>Source</em>}' containment reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getSource() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<SourceRef> source; | |
/** | |
* The default value of the '{@link #getText() <em>Text</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getText() | |
* @generated | |
* @ordered | |
*/ | |
protected static final String TEXT_EDEFAULT = null; | |
/** | |
* The cached value of the '{@link #getText() <em>Text</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getText() | |
* @generated | |
* @ordered | |
*/ | |
protected String text = TEXT_EDEFAULT; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected BuildDescriptionImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return BuildPackage.Literals.BUILD_DESCRIPTION; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<SourceRef> getSource() { | |
if (source == null) { | |
source = new EObjectContainmentEList<SourceRef>(SourceRef.class, this, BuildPackage.BUILD_DESCRIPTION__SOURCE); | |
} | |
return source; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public String getText() { | |
return text; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setText(String newText) { | |
String oldText = text; | |
text = newText; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, BuildPackage.BUILD_DESCRIPTION__TEXT, oldText, text)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case BuildPackage.BUILD_DESCRIPTION__SOURCE: | |
return ((InternalEList<?>)getSource()).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 BuildPackage.BUILD_DESCRIPTION__SOURCE: | |
return getSource(); | |
case BuildPackage.BUILD_DESCRIPTION__TEXT: | |
return getText(); | |
} | |
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 BuildPackage.BUILD_DESCRIPTION__SOURCE: | |
getSource().clear(); | |
getSource().addAll((Collection<? extends SourceRef>)newValue); | |
return; | |
case BuildPackage.BUILD_DESCRIPTION__TEXT: | |
setText((String)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case BuildPackage.BUILD_DESCRIPTION__SOURCE: | |
getSource().clear(); | |
return; | |
case BuildPackage.BUILD_DESCRIPTION__TEXT: | |
setText(TEXT_EDEFAULT); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case BuildPackage.BUILD_DESCRIPTION__SOURCE: | |
return source != null && !source.isEmpty(); | |
case BuildPackage.BUILD_DESCRIPTION__TEXT: | |
return TEXT_EDEFAULT == null ? text != null : !TEXT_EDEFAULT.equals(text); | |
} | |
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(" (text: "); //$NON-NLS-1$ | |
result.append(text); | |
result.append(')'); | |
return result.toString(); | |
} | |
} //BuildDescriptionImpl |