/**
*/
package rba.view.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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import rba.view.Area;
import rba.view.FixedPositionLayout;
import rba.view.PositionContainer;
import rba.view.RBAViewPackage;
/**
* An implementation of the model object 'Fixed Position Layout'.
*
* The following features are implemented:
*
*
* - {@link rba.view.impl.FixedPositionLayoutImpl#getSubAreaPosition Sub Area Position}
*
*
* @generated
*/
public class FixedPositionLayoutImpl extends LayoutManagerImpl implements FixedPositionLayout {
/**
* The cached value of the '{@link #getSubAreaPosition() Sub Area Position}' containment reference list.
* @see #getSubAreaPosition()
* @generated
* @ordered
*/
protected EList subAreaPosition;
/**
*
* @generated
*/
protected FixedPositionLayoutImpl() {
super();
}
/**
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return RBAViewPackage.Literals.FIXED_POSITION_LAYOUT;
}
/**
*
* @generated
*/
public EList getSubAreaPosition() {
if (subAreaPosition == null) {
subAreaPosition = new EObjectContainmentEList(PositionContainer.class, this,
RBAViewPackage.FIXED_POSITION_LAYOUT__SUB_AREA_POSITION);
}
return subAreaPosition;
}
/**
*
* @generated
*/
public EList collectLeafArea() {
java.util.Set areas = new java.util.HashSet();
for (PositionContainer pc : getSubAreaPosition()) {
areas.addAll(pc.getArea().collectLeafAllocatable().stream().map(allocatable -> (Area) allocatable)
.collect(java.util.stream.Collectors.toList()));
}
return new org.eclipse.emf.common.util.BasicEList(areas);
}
/**
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case RBAViewPackage.FIXED_POSITION_LAYOUT__SUB_AREA_POSITION:
return ((InternalEList>) getSubAreaPosition()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case RBAViewPackage.FIXED_POSITION_LAYOUT__SUB_AREA_POSITION:
return getSubAreaPosition();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case RBAViewPackage.FIXED_POSITION_LAYOUT__SUB_AREA_POSITION:
getSubAreaPosition().clear();
getSubAreaPosition().addAll((Collection extends PositionContainer>) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case RBAViewPackage.FIXED_POSITION_LAYOUT__SUB_AREA_POSITION:
getSubAreaPosition().clear();
return;
}
super.eUnset(featureID);
}
/**
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case RBAViewPackage.FIXED_POSITION_LAYOUT__SUB_AREA_POSITION:
return subAreaPosition != null && !subAreaPosition.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
* @generated
*/
@Override
public Object eInvoke(int operationID, EList> arguments) throws InvocationTargetException {
switch (operationID) {
case RBAViewPackage.FIXED_POSITION_LAYOUT___COLLECT_LEAF_AREA:
return collectLeafArea();
}
return super.eInvoke(operationID, arguments);
}
} // FixedPositionLayoutImpl