org.eclipse.emf.ecore.change.util
Class ListDifferenceAnalyzer

java.lang.Object
  extended by org.eclipse.emf.ecore.change.util.ListDifferenceAnalyzer
Direct Known Subclasses:
BasicChangeRecorder

public class ListDifferenceAnalyzer
extends java.lang.Object

Abstract class implementing the methods required to compute differences between lists. The differences are described by ListChange objects.

Since:
2.3

Constructor Summary
ListDifferenceAnalyzer()
           
 
Method Summary
 EList<ListChange> analyzeLists(EList<?> oldList, EList<?> newList)
          Analyzes the differences between two lists, returning the list changes that describe how the newList could be changed to the contents of oldList.
 void analyzeLists(EList<java.lang.Object> oldList, EList<?> newList, EList<ListChange> listChanges)
          Analyzes the differences between two lists, adding new list changes to the specified listChanges.
protected  void createAddListChange(EList<java.lang.Object> oldList, EList<ListChange> listChanges, java.lang.Object newObject, int index)
          Convenience method added to allow subclasses to modify the default implementation for the scenario in which an element was added to the monitored list.
protected  ListChange createListChange(EList<ListChange> listChanges, ChangeKind kind, int index)
          Creates a ListChange, initializes the main attributes, and adds it to the specified listChanges.
protected  void createListChanges(EList<java.lang.Object> oldList, EList<?> newList, EList<ListChange> listChanges)
           
protected  void createMoveListChange(EList<?> oldList, EList<ListChange> listChanges, java.lang.Object newObject, int index, int toIndex)
          Convenience method added to allow subclasses to modify the default implementation for the scenario in which an element was moved in the monitored list.
protected  void createRemoveListChange(EList<?> oldList, EList<ListChange> listChanges, java.lang.Object newObject, int index)
          Convenience method added to allow subclasses to modify the default implementation for the scenario in which an element was removed from the monitored list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListDifferenceAnalyzer

public ListDifferenceAnalyzer()
Method Detail

analyzeLists

public EList<ListChange> analyzeLists(EList<?> oldList,
                                      EList<?> newList)
Analyzes the differences between two lists, returning the list changes that describe how the newList could be changed to the contents of oldList. The lists are not modified by this method.

Parameters:
oldList -
newList -
Returns:
a list of ListChange

analyzeLists

public void analyzeLists(EList<java.lang.Object> oldList,
                         EList<?> newList,
                         EList<ListChange> listChanges)

Analyzes the differences between two lists, adding new list changes to the specified listChanges. The list changes describe how the newList should be manipulated in order to have the same contents of oldList

This methods changes the contents of oldList

Parameters:
oldList -
newList -
listChanges -

createListChanges

protected void createListChanges(EList<java.lang.Object> oldList,
                                 EList<?> newList,
                                 EList<ListChange> listChanges)
See Also:
analyzeLists(EList, EList, EList)

createAddListChange

protected void createAddListChange(EList<java.lang.Object> oldList,
                                   EList<ListChange> listChanges,
                                   java.lang.Object newObject,
                                   int index)
Convenience method added to allow subclasses to modify the default implementation for the scenario in which an element was added to the monitored list.

See Also:
createListChanges(EList, EList, EList)

createRemoveListChange

protected void createRemoveListChange(EList<?> oldList,
                                      EList<ListChange> listChanges,
                                      java.lang.Object newObject,
                                      int index)
Convenience method added to allow subclasses to modify the default implementation for the scenario in which an element was removed from the monitored list.

See Also:
createListChanges(EList, EList, EList)

createMoveListChange

protected void createMoveListChange(EList<?> oldList,
                                    EList<ListChange> listChanges,
                                    java.lang.Object newObject,
                                    int index,
                                    int toIndex)
Convenience method added to allow subclasses to modify the default implementation for the scenario in which an element was moved in the monitored list.

See Also:
createListChanges(EList, EList, EList)

createListChange

protected ListChange createListChange(EList<ListChange> listChanges,
                                      ChangeKind kind,
                                      int index)
Creates a ListChange, initializes the main attributes, and adds it to the specified listChanges.

Parameters:
listChanges -
kind -
index -
Returns:
ListChange

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.