Class BmListMergeSupport


  • public class BmListMergeSupport
    extends Object
    Special list analyzer for updating EList in model by new values
    • Constructor Detail

      • BmListMergeSupport

        public BmListMergeSupport()
    • Method Detail

      • merge

        public <T> void merge​(org.eclipse.emf.common.util.EList<T> externalValue,
                              org.eclipse.emf.common.util.EList<T> internalValue)
        Same as {@link merge(EList, EList, true)}
        Parameters:
        externalValue - contains external values, not modified, can't be null
        internalValue - updating values, will be modified in method, can't be null
        See Also:
        merge(EList, EList, boolean)
      • merge

        public <T> void merge​(org.eclipse.emf.common.util.EList<T> externalValue,
                              org.eclipse.emf.common.util.EList<T> internalValue,
                              boolean containment)
        Merges internalValue by externalValue. After updates interanlValue will contains only elements from externalValue in the same order.
        • Stage 1: finds elements from internalValue which's contained in externalValue and remember their positions in externalValue
        • Stage 2: add new elements from externalValue to internalValue and remember their positions in externalValue
        • Stage 3: remove old elements from internalValue which is not contained in externalValue. And then reordering elements in internalValue corresponding to externalValue
        Parameters:
        externalValue - contains external values, not modified, can't be null
        internalValue - updating values, will be modified in method, can't be null
        containment - true if collections are values of containment feature, false otherwise.
      • equal

        protected boolean equal​(Object oldValue,
                                Object newValue)
        Used by merge(EList, EList) to decide whether the old value is considered equal to the new value.
        Parameters:
        oldValue - old value, can be null
        newValue - new value, can be null
        Returns:
        true if oldValue equals newValue, false otherwise