Class ListDiffVisitor<E>
java.lang.Object
org.eclipse.core.databinding.observable.list.ListDiffVisitor<E>
- Type Parameters:
E
- the type of the elements in the list
A visitor for processing differences in a ListDiff.
- Since:
- 1.1
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
Notifies the visitor thatelement
was added to the list at positionindex
.void
handleMove
(int oldIndex, int newIndex, E element) Notifies the visitor thatelement
was moved in the list from positionoldIndex
to positionnewIndex
.abstract void
handleRemove
(int index, E element) Notifies the visitor thatelement
was removed from the list at positionindex
.void
handleReplace
(int index, E oldElement, E newElement) Notifies the visitor thatoldElement
, located at positionindex
in the list, was replaced bynewElement
.
-
Constructor Details
-
ListDiffVisitor
public ListDiffVisitor()
-
-
Method Details
-
handleAdd
Notifies the visitor thatelement
was added to the list at positionindex
.- Parameters:
index
- the index where the element was addedelement
- the element that was added
-
handleRemove
Notifies the visitor thatelement
was removed from the list at positionindex
.- Parameters:
index
- the index where the element was removedelement
- the element that was removed
-
handleMove
Notifies the visitor thatelement
was moved in the list from positionoldIndex
to positionnewIndex
.The default implementation of this method calls
handleRemove(int, Object)
with the old position, thenhandleAdd(int, Object)
with the new position. Clients which are interested in recognizing "moves" in a list (i.e. calls toIObservableList.move(int, int)
) should override this method.- Parameters:
oldIndex
- the index that the element was moved from.newIndex
- the index that the element was moved to.element
- the element that was moved- See Also:
-
handleReplace
Notifies the visitor thatoldElement
, located at positionindex
in the list, was replaced bynewElement
.The default implementation of this method calls
handleRemove(int, Object)
with the old element, thenhandleAdd(int, Object)
with the new element. Clients which are interested in recognizing "replaces" in a list (i.e. calls toList.set(int, Object)
) should override this method.- Parameters:
index
- the index where the element was replaced.oldElement
- the element being replaced.newElement
- the element that replaced oldElement.- See Also:
-