/**
* -------------------------------------------
*/
public static class ResolvingFeatureEIterator<E> extends FeatureEIterator<E> {
public ResolvingFeatureEIterator(EStructuralFeature eStructuralFeature, FeatureMap.Internal featureMap) {
super(eStructuralFeature, featureMap);
}
@Override protected boolean resolve() {
return true;
}
}
/**
* Temporary for testing purposes only.
*/
public static class FeatureMapEObjectImpl extends org.eclipse.emf.ecore.impl.EObjectImpl {
protected [[#variable170e9c40]] featureMap = [[#variable170e9bc0]];
public FeatureMapEObjectImpl() {
super();
}
@Override public Object eDynamicGet(EStructuralFeature eFeature, boolean resolve) {
if (eFeature instanceof EReference && ((EReference) eFeature).isContainer()) {
return eSettingDelegate(eFeature).dynamicGet(this, null, -1, true, true);
}
else {
return featureMap.setting(eFeature).get(resolve);
}
}
@Override public void eDynamicSet(EStructuralFeature eFeature, Object newValue) {
if (eFeature instanceof EReference && ((EReference) eFeature).isContainer()) {
eSettingDelegate(eFeature).dynamicSet(this, null, -1, newValue);
}
else {
if ( !eFeature.isUnsettable()) {
Object defaultValue = eFeature.getDefaultValue();
if (defaultValue == null ? newValue == null: defaultValue.equals(newValue)) {
featureMap.setting(eFeature).unset();
return;
}
}
featureMap.setting(eFeature).set(newValue);
}
}
@Override public void eDynamicUnset(EStructuralFeature eFeature) {
if (eFeature instanceof EReference && ((EReference) eFeature).isContainer()) {
eSettingDelegate(eFeature).dynamicUnset(this, null, -1);
}
else {
featureMap.setting(eFeature).unset();
}
}
@Override public boolean eDynamicIsSet(EStructuralFeature eFeature) {
if (eFeature instanceof EReference && ((EReference) eFeature).isContainer()) {
return eSettingDelegate(eFeature).dynamicIsSet(this, null, -1);
}
else {
return featureMap.setting(eFeature).isSet();
}
}
@Override public NotificationChain eDynamicInverseAdd(InternalEObject otherEnd, int featureID, Class<? > inverseClass, NotificationChain notifications) {
EStructuralFeature.Internal feature = (EStructuralFeature.Internal) eClass().getEStructuralFeature(featureID);
if (feature.isMany()) {
return featureMap.basicAdd(feature, otherEnd, notifications);
}
else
if (feature instanceof EReference && ((EReference) feature).isContainer()) {
return eSettingDelegate(feature).dynamicInverseAdd(this, null, -1, otherEnd, notifications);
}
else {
InternalEObject oldValue = (InternalEObject) eDynamicGet(feature, false);
if (oldValue != null) {
notifications = oldValue.eInverseRemove(this, oldValue.eClass().getFeatureID(((EReference) feature).getEOpposite()), null, notifications);
notifications = featureMap.basicRemove(feature, oldValue, notifications);
}
return featureMap.basicAdd(feature, otherEnd, notifications);
}
}
@Override public NotificationChain eDynamicInverseRemove(InternalEObject otherEnd, int featureID, Class<? > inverseClass, NotificationChain notifications) {
EStructuralFeature.Internal feature = (EStructuralFeature.Internal) eClass().getEStructuralFeature(featureID);
if (feature instanceof EReference && ((EReference) feature).isContainer()) {
return eSettingDelegate(feature).dynamicInverseRemove(this, null, -1, otherEnd, notifications);
}
else {
return featureMap.basicRemove(feature, otherEnd, notifications);
}
}
public FeatureMap featureMap() {
return featureMap;
}
@Override public void eNotify(Notification notification) {
if (notification.getFeatureID(null) != -1) {
super.eNotify(notification);
}
}
@Override public String toString() {
String result = super.toString();
result = "org.eclipse.emf.ecore.impl.EObjectImpl" + result.substring(result.indexOf("@"));
return result;
}
}
@Override public void set(Object newValue) {
super.set(newValue instanceof FeatureMap ? newValue: ((FeatureMap.Internal.Wrapper) newValue).featureMap());
}
|