/**
*/
package questionairemodel.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.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import questionairemodel.QuestionBase;
import questionairemodel.QuestionCondition;
import questionairemodel.QuestionairemodelPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Question Base</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link questionairemodel.impl.QuestionBaseImpl#getTitle <em>Title</em>}</li>
* <li>{@link questionairemodel.impl.QuestionBaseImpl#getDescription <em>Description</em>}</li>
* <li>{@link questionairemodel.impl.QuestionBaseImpl#getConditions <em>Conditions</em>}</li>
* <li>{@link questionairemodel.impl.QuestionBaseImpl#isMandatory <em>Mandatory</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class QuestionBaseImpl extends MinimalEObjectImpl.Container implements QuestionBase {
/**
* The default value of the '{@link #getTitle() <em>Title</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTitle()
* @generated
* @ordered
*/
protected static final String TITLE_EDEFAULT = null;
/**
* The cached value of the '{@link #getTitle() <em>Title</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTitle()
* @generated
* @ordered
*/
protected String title = TITLE_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 #getConditions() <em>Conditions</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConditions()
* @generated
* @ordered
*/
protected EList<QuestionCondition> conditions;
/**
* The default value of the '{@link #isMandatory() <em>Mandatory</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isMandatory()
* @generated
* @ordered
*/
protected static final boolean MANDATORY_EDEFAULT = false;
/**
* The cached value of the '{@link #isMandatory() <em>Mandatory</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isMandatory()
* @generated
* @ordered
*/
protected boolean mandatory = MANDATORY_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected QuestionBaseImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QuestionairemodelPackage.Literals.QUESTION_BASE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getTitle() {
return title;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTitle(String newTitle) {
String oldTitle = title;
title = newTitle;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QuestionairemodelPackage.QUESTION_BASE__TITLE, oldTitle, title));
}
/**
* <!-- 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, QuestionairemodelPackage.QUESTION_BASE__DESCRIPTION, oldDescription, description));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<QuestionCondition> getConditions() {
if (conditions == null) {
conditions = new EObjectContainmentEList<QuestionCondition>(QuestionCondition.class, this, QuestionairemodelPackage.QUESTION_BASE__CONDITIONS);
}
return conditions;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isMandatory() {
return mandatory;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMandatory(boolean newMandatory) {
boolean oldMandatory = mandatory;
mandatory = newMandatory;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QuestionairemodelPackage.QUESTION_BASE__MANDATORY, oldMandatory, mandatory));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case QuestionairemodelPackage.QUESTION_BASE__CONDITIONS:
return ((InternalEList<?>)getConditions()).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 QuestionairemodelPackage.QUESTION_BASE__TITLE:
return getTitle();
case QuestionairemodelPackage.QUESTION_BASE__DESCRIPTION:
return getDescription();
case QuestionairemodelPackage.QUESTION_BASE__CONDITIONS:
return getConditions();
case QuestionairemodelPackage.QUESTION_BASE__MANDATORY:
return isMandatory();
}
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 QuestionairemodelPackage.QUESTION_BASE__TITLE:
setTitle((String)newValue);
return;
case QuestionairemodelPackage.QUESTION_BASE__DESCRIPTION:
setDescription((String)newValue);
return;
case QuestionairemodelPackage.QUESTION_BASE__CONDITIONS:
getConditions().clear();
getConditions().addAll((Collection<? extends QuestionCondition>)newValue);
return;
case QuestionairemodelPackage.QUESTION_BASE__MANDATORY:
setMandatory((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case QuestionairemodelPackage.QUESTION_BASE__TITLE:
setTitle(TITLE_EDEFAULT);
return;
case QuestionairemodelPackage.QUESTION_BASE__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case QuestionairemodelPackage.QUESTION_BASE__CONDITIONS:
getConditions().clear();
return;
case QuestionairemodelPackage.QUESTION_BASE__MANDATORY:
setMandatory(MANDATORY_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case QuestionairemodelPackage.QUESTION_BASE__TITLE:
return TITLE_EDEFAULT == null ? title != null : !TITLE_EDEFAULT.equals(title);
case QuestionairemodelPackage.QUESTION_BASE__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
case QuestionairemodelPackage.QUESTION_BASE__CONDITIONS:
return conditions != null && !conditions.isEmpty();
case QuestionairemodelPackage.QUESTION_BASE__MANDATORY:
return mandatory != MANDATORY_EDEFAULT;
}
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(" (title: ");
result.append(title);
result.append(", description: ");
result.append(description);
result.append(", mandatory: ");
result.append(mandatory);
result.append(')');
return result.toString();
}
} //QuestionBaseImpl