/**
*/
package fr.inria.atlanmod.collaboro.history.impl;
import fr.inria.atlanmod.collaboro.history.History;
import fr.inria.atlanmod.collaboro.history.HistoryPackage;
import fr.inria.atlanmod.collaboro.history.User;
import fr.inria.atlanmod.collaboro.history.VersionHistory;
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.EObjectImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>History</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link fr.inria.atlanmod.collaboro.history.impl.HistoryImpl#getUsers <em>Users</em>}</li>
* <li>{@link fr.inria.atlanmod.collaboro.history.impl.HistoryImpl#getHistories <em>Histories</em>}</li>
* <li>{@link fr.inria.atlanmod.collaboro.history.impl.HistoryImpl#getLanguage <em>Language</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class HistoryImpl extends EObjectImpl implements History {
/**
* The cached value of the '{@link #getUsers() <em>Users</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUsers()
* @generated
* @ordered
*/
protected EList<User> users;
/**
* The cached value of the '{@link #getHistories() <em>Histories</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getHistories()
* @generated
* @ordered
*/
protected EList<VersionHistory> histories;
/**
* The default value of the '{@link #getLanguage() <em>Language</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLanguage()
* @generated
* @ordered
*/
protected static final String LANGUAGE_EDEFAULT = null;
/**
* The cached value of the '{@link #getLanguage() <em>Language</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLanguage()
* @generated
* @ordered
*/
protected String language = LANGUAGE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected HistoryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return HistoryPackage.Literals.HISTORY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<User> getUsers() {
if (users == null) {
users = new EObjectContainmentEList<User>(User.class, this, HistoryPackage.HISTORY__USERS);
}
return users;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<VersionHistory> getHistories() {
if (histories == null) {
histories = new EObjectContainmentEList<VersionHistory>(VersionHistory.class, this, HistoryPackage.HISTORY__HISTORIES);
}
return histories;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLanguage() {
return language;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLanguage(String newLanguage) {
String oldLanguage = language;
language = newLanguage;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, HistoryPackage.HISTORY__LANGUAGE, oldLanguage, language));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case HistoryPackage.HISTORY__USERS:
return ((InternalEList<?>)getUsers()).basicRemove(otherEnd, msgs);
case HistoryPackage.HISTORY__HISTORIES:
return ((InternalEList<?>)getHistories()).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 HistoryPackage.HISTORY__USERS:
return getUsers();
case HistoryPackage.HISTORY__HISTORIES:
return getHistories();
case HistoryPackage.HISTORY__LANGUAGE:
return getLanguage();
}
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 HistoryPackage.HISTORY__USERS:
getUsers().clear();
getUsers().addAll((Collection<? extends User>)newValue);
return;
case HistoryPackage.HISTORY__HISTORIES:
getHistories().clear();
getHistories().addAll((Collection<? extends VersionHistory>)newValue);
return;
case HistoryPackage.HISTORY__LANGUAGE:
setLanguage((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case HistoryPackage.HISTORY__USERS:
getUsers().clear();
return;
case HistoryPackage.HISTORY__HISTORIES:
getHistories().clear();
return;
case HistoryPackage.HISTORY__LANGUAGE:
setLanguage(LANGUAGE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case HistoryPackage.HISTORY__USERS:
return users != null && !users.isEmpty();
case HistoryPackage.HISTORY__HISTORIES:
return histories != null && !histories.isEmpty();
case HistoryPackage.HISTORY__LANGUAGE:
return LANGUAGE_EDEFAULT == null ? language != null : !LANGUAGE_EDEFAULT.equals(language);
}
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(" (language: ");
result.append(language);
result.append(')');
return result.toString();
}
} //HistoryImpl