protected boolean isMany(EStructuralFeature feature) { return FeatureMapUtil.isMany(owner, feature); }
protected boolean isMany(EStructuralFeature feature) { return FeatureMapUtil.isMany(owner, feature); }
protected boolean isMany(EStructuralFeature feature) { return FeatureMapUtil.isMany(owner, feature); }
protected boolean isMany(EStructuralFeature feature) { return FeatureMapUtil.isMany(owner, feature); }
/** * Replaces the old value in the object's feature with the new value. * @param eObject the object holding the values. * @param eStructuralFeature the feature of the object holding the values. * @param oldValue the value to replace. * @param newValue the replacement value. */ public static void replace(EObject eObject, EStructuralFeature eStructuralFeature, Object oldValue, Object newValue) { if (FeatureMapUtil.isMany(eObject, eStructuralFeature)) { @SuppressWarnings("unchecked") List<Object> list = (List<Object>)eObject.eGet(eStructuralFeature); list.set(list.indexOf(oldValue), newValue); } else { eObject.eSet(eStructuralFeature, newValue); } }
/** * Replaces the old value in the object's feature with the new value. * @param eObject the object holding the values. * @param eStructuralFeature the feature of the object holding the values. * @param oldValue the value to replace. * @param newValue the replacement value. */ public static void replace(EObject eObject, EStructuralFeature eStructuralFeature, Object oldValue, Object newValue) { if (FeatureMapUtil.isMany(eObject, eStructuralFeature)) { @SuppressWarnings("unchecked") List<Object> list = (List<Object>)eObject.eGet(eStructuralFeature); list.set(list.indexOf(oldValue), newValue); } else { eObject.eSet(eStructuralFeature, newValue); } }
/** * Removes the value from the feature of the object. * @param eObject the object holding the value. * @param eStructuralFeature the feature of the object holding the value. * @param value the value to remove. */ public static void remove(EObject eObject, EStructuralFeature eStructuralFeature, Object value) { if (FeatureMapUtil.isMany(eObject, eStructuralFeature)) { ((List<?>)eObject.eGet(eStructuralFeature)).remove(value); } else { eObject.eUnset(eStructuralFeature); } }
/** * Removes the value from the feature of the object. * @param eObject the object holding the value. * @param eStructuralFeature the feature of the object holding the value. * @param value the value to remove. */ public static void remove(EObject eObject, EStructuralFeature eStructuralFeature, Object value) { if (FeatureMapUtil.isMany(eObject, eStructuralFeature)) { ((List<?>)eObject.eGet(eStructuralFeature)).remove(value); } else { eObject.eUnset(eStructuralFeature); } }
/** * Removes the values from the feature of the object. * * @param eObject the object holding the value. * @param eStructuralFeature the feature of the object holding the value. * @param values the values to remove. * @see EcoreUtil#remove(EObject, EStructuralFeature, Object) * @since 2.13 */ public static void removeAll(EObject eObject, EStructuralFeature eStructuralFeature, Collection<?> values) { if (FeatureMapUtil.isMany(eObject, eStructuralFeature)) { ((List<?>)eObject.eGet(eStructuralFeature)).removeAll(values); } else { // The feature is assumed to hold the value. eObject.eUnset(eStructuralFeature); } }
if (FeatureMapUtil.isMany(eObject, eStructuralFeature))
/** * Replaces the old value in the setting with the new value. * @param setting the setting holding the values. * @param oldValue the value to replace. * @param newValue the replacement value. */ public static void replace(EStructuralFeature.Setting setting, Object oldValue, Object newValue) { if (FeatureMapUtil.isMany(setting.getEObject(), setting.getEStructuralFeature())) { @SuppressWarnings("unchecked") List<Object> list = (List<Object>)setting.get(false); list.set(list.indexOf(oldValue), newValue); } else { setting.set(newValue); } }
/** * Replaces the old value in the setting with the new value. * @param setting the setting holding the values. * @param oldValue the value to replace. * @param newValue the replacement value. */ public static void replace(EStructuralFeature.Setting setting, Object oldValue, Object newValue) { if (FeatureMapUtil.isMany(setting.getEObject(), setting.getEStructuralFeature())) { @SuppressWarnings("unchecked") List<Object> list = (List<Object>)setting.get(false); list.set(list.indexOf(oldValue), newValue); } else { setting.set(newValue); } }
/** * Removes the value from the setting. * @param setting the setting holding the value. * @param value the value to remove. */ public static void remove(EStructuralFeature.Setting setting, Object value) { if (FeatureMapUtil.isMany(setting.getEObject(), setting.getEStructuralFeature())) { ((List<?>)setting.get(false)).remove(value); } else { setting.unset(); } }
/** * Removes the value from the setting. * @param setting the setting holding the value. * @param value the value to remove. */ public static void remove(EStructuralFeature.Setting setting, Object value) { if (FeatureMapUtil.isMany(setting.getEObject(), setting.getEStructuralFeature())) { ((List<?>)setting.get(false)).remove(value); } else { setting.unset(); } }
/** * Removes the values from the setting. * * @param setting the setting holding the value. * @param values the values to remove. * @since 2.13 */ public static void removeAll(EStructuralFeature.Setting setting, Collection<?> values) { if (FeatureMapUtil.isMany(setting.getEObject(), setting.getEStructuralFeature())) { ((List<?>)setting.get(false)).removeAll(values); } else { // The feature is assumed to hold the value. setting.unset(); } }
/** * Replace the object in its {@link EObject#eResource containing} resource * and/or its {@link EObject#eContainer containing} object, * with the replacement object. * @param eObject the object to replace. * @param replacementEObject the replacement object. */ public static void replace(EObject eObject, EObject replacementEObject) { EObject container = eObject.eContainer(); if (container != null) { EReference feature = eObject.eContainmentFeature(); if (FeatureMapUtil.isMany(container, feature)) { @SuppressWarnings("unchecked") List<Object> list = (List<Object>)container.eGet(feature); list.set(list.indexOf(eObject), replacementEObject); } else { container.eSet(feature, replacementEObject); } } Resource resource = ((InternalEObject)eObject).eDirectResource(); if (resource != null) { List<EObject> list = resource.getContents(); list.set(list.indexOf(eObject), replacementEObject); } }
/** * Replace the object in its {@link EObject#eResource containing} resource * and/or its {@link EObject#eContainer containing} object, * with the replacement object. * @param eObject the object to replace. * @param replacementEObject the replacement object. */ public static void replace(EObject eObject, EObject replacementEObject) { EObject container = eObject.eContainer(); if (container != null) { EReference feature = eObject.eContainmentFeature(); if (FeatureMapUtil.isMany(container, feature)) { @SuppressWarnings("unchecked") List<Object> list = (List<Object>)container.eGet(feature); list.set(list.indexOf(eObject), replacementEObject); } else { container.eSet(feature, replacementEObject); } } Resource resource = ((InternalEObject)eObject).eDirectResource(); if (resource != null) { List<EObject> list = resource.getContents(); list.set(list.indexOf(eObject), replacementEObject); } }
else if (!entryFeatures.add(entryFeature) && !FeatureMapUtil.isMany(owner, entryFeature))
/** * Removes the object from its {@link EObject#eResource containing} resource * and/or its {@link EObject#eContainer containing} object. * @param eObject the object to remove. */ public static void remove(EObject eObject) { InternalEObject internalEObject = (InternalEObject)eObject; EObject container = internalEObject.eInternalContainer(); if (container != null) { EReference feature = eObject.eContainmentFeature(); if (FeatureMapUtil.isMany(container, feature)) { ((EList<?>)container.eGet(feature)).remove(eObject); } else { container.eUnset(feature); } } Resource resource = internalEObject.eDirectResource(); if (resource != null) { resource.getContents().remove(eObject); } }
/** * Removes the object from its {@link EObject#eResource containing} resource * and/or its {@link EObject#eContainer containing} object. * @param eObject the object to remove. */ public static void remove(EObject eObject) { InternalEObject internalEObject = (InternalEObject)eObject; EObject container = internalEObject.eInternalContainer(); if (container != null) { EReference feature = eObject.eContainmentFeature(); if (FeatureMapUtil.isMany(container, feature)) { ((EList<?>)container.eGet(feature)).remove(eObject); } else { container.eUnset(feature); } } Resource resource = internalEObject.eDirectResource(); if (resource != null) { resource.getContents().remove(eObject); } }