/**
* <copyright>
* </copyright>
*
* $Id$
*/
package edu.isistan.uima.unified.typesystems.srl.impl;
import edu.isistan.uima.unified.typesystems.impl.IdentifiableAnnotationImpl;
import edu.isistan.uima.unified.typesystems.nlp.Token;
import edu.isistan.uima.unified.typesystems.srl.Argument;
import edu.isistan.uima.unified.typesystems.srl.SRLPackage;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
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.EObjectResolvingEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Argument</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link edu.isistan.uima.unified.typesystems.srl.impl.ArgumentImpl#getLabel <em>Label</em>}</li>
* <li>{@link edu.isistan.uima.unified.typesystems.srl.impl.ArgumentImpl#getDescription <em>Description</em>}</li>
* <li>{@link edu.isistan.uima.unified.typesystems.srl.impl.ArgumentImpl#getRoot <em>Root</em>}</li>
* <li>{@link edu.isistan.uima.unified.typesystems.srl.impl.ArgumentImpl#getYield <em>Yield</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ArgumentImpl extends IdentifiableAnnotationImpl implements Argument {
/**
* The default value of the '{@link #getLabel() <em>Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabel()
* @generated
* @ordered
*/
protected static final String LABEL_EDEFAULT = null;
/**
* The cached value of the '{@link #getLabel() <em>Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabel()
* @generated
* @ordered
*/
protected String label = LABEL_EDEFAULT;
/**
* The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected static final String DESCRIPTION_EDEFAULT = null;
/**
* The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected String description = DESCRIPTION_EDEFAULT;
/**
* The cached value of the '{@link #getRoot() <em>Root</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRoot()
* @generated
* @ordered
*/
protected Token root;
/**
* The cached value of the '{@link #getYield() <em>Yield</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getYield()
* @generated
* @ordered
*/
protected EList<Token> yield;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ArgumentImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return SRLPackage.Literals.ARGUMENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLabel() {
return label;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLabel(String newLabel) {
String oldLabel = label;
label = newLabel;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SRLPackage.ARGUMENT__LABEL, oldLabel, label));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDescription() {
return description;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDescription(String newDescription) {
String oldDescription = description;
description = newDescription;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SRLPackage.ARGUMENT__DESCRIPTION, oldDescription, description));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Token getRoot() {
if (root != null && root.eIsProxy()) {
InternalEObject oldRoot = (InternalEObject)root;
root = (Token)eResolveProxy(oldRoot);
if (root != oldRoot) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, SRLPackage.ARGUMENT__ROOT, oldRoot, root));
}
}
return root;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Token basicGetRoot() {
return root;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRoot(Token newRoot) {
Token oldRoot = root;
root = newRoot;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SRLPackage.ARGUMENT__ROOT, oldRoot, root));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Token> getYield() {
if (yield == null) {
yield = new EObjectResolvingEList<Token>(Token.class, this, SRLPackage.ARGUMENT__YIELD);
}
return yield;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case SRLPackage.ARGUMENT__LABEL:
return getLabel();
case SRLPackage.ARGUMENT__DESCRIPTION:
return getDescription();
case SRLPackage.ARGUMENT__ROOT:
if (resolve) return getRoot();
return basicGetRoot();
case SRLPackage.ARGUMENT__YIELD:
return getYield();
}
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 SRLPackage.ARGUMENT__LABEL:
setLabel((String)newValue);
return;
case SRLPackage.ARGUMENT__DESCRIPTION:
setDescription((String)newValue);
return;
case SRLPackage.ARGUMENT__ROOT:
setRoot((Token)newValue);
return;
case SRLPackage.ARGUMENT__YIELD:
getYield().clear();
getYield().addAll((Collection<? extends Token>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case SRLPackage.ARGUMENT__LABEL:
setLabel(LABEL_EDEFAULT);
return;
case SRLPackage.ARGUMENT__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case SRLPackage.ARGUMENT__ROOT:
setRoot((Token)null);
return;
case SRLPackage.ARGUMENT__YIELD:
getYield().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SRLPackage.ARGUMENT__LABEL:
return LABEL_EDEFAULT == null ? label != null : !LABEL_EDEFAULT.equals(label);
case SRLPackage.ARGUMENT__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
case SRLPackage.ARGUMENT__ROOT:
return root != null;
case SRLPackage.ARGUMENT__YIELD:
return yield != null && !yield.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(" (label: ");
result.append(label);
result.append(", description: ");
result.append(description);
result.append(')');
return result.toString();
}
} //ArgumentImpl