/**
*/
package rba.core.impl;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
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.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import rba.core.AbstractContent;
import rba.core.Content;
import rba.core.ContentSet;
import rba.core.RBACorePackage;
/**
* An implementation of the model object 'Content Set'.
*
* The following features are implemented:
*
*
* - {@link rba.core.impl.ContentSetImpl#getTarget Target}
*
*
* @generated
*/
public abstract class ContentSetImpl extends AbstractContentImpl implements ContentSet {
/**
* The cached value of the '{@link #getTarget() Target}' reference list.
* @see #getTarget()
* @generated
* @ordered
*/
protected EList target;
/**
*
* @generated
*/
protected ContentSetImpl() {
super();
}
/**
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return RBACorePackage.Literals.CONTENT_SET;
}
/**
*
* @generated
*/
public EList getTarget() {
if (target == null) {
target = new EObjectWithInverseResolvingEList.ManyInverse(AbstractContent.class, this,
RBACorePackage.CONTENT_SET__TARGET, RBACorePackage.ABSTRACT_CONTENT__CONTENT_GROUP);
}
return target;
}
/**
*
* @generated
*/
public EList collectLeafContents() {
java.util.Set contents = new java.util.LinkedHashSet();
getTarget().forEach(content -> contents.addAll(content.collectLeafContents()));
return new org.eclipse.emf.common.util.BasicEList(contents);
}
/**
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case RBACorePackage.CONTENT_SET__TARGET:
return ((InternalEList) (InternalEList>) getTarget()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case RBACorePackage.CONTENT_SET__TARGET:
return ((InternalEList>) getTarget()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case RBACorePackage.CONTENT_SET__TARGET:
return getTarget();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case RBACorePackage.CONTENT_SET__TARGET:
getTarget().clear();
getTarget().addAll((Collection extends AbstractContent>) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case RBACorePackage.CONTENT_SET__TARGET:
getTarget().clear();
return;
}
super.eUnset(featureID);
}
/**
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case RBACorePackage.CONTENT_SET__TARGET:
return target != null && !target.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
* @generated
*/
@Override
public Object eInvoke(int operationID, EList> arguments) throws InvocationTargetException {
switch (operationID) {
case RBACorePackage.CONTENT_SET___COLLECT_LEAF_CONTENTS:
return collectLeafContents();
}
return super.eInvoke(operationID, arguments);
}
} // ContentSetImpl