Interface DiffListener<E>

  • Type Parameters:
    E - the type of the elements that may be inserted, deleted, or changed; for example, in a text file each element might be a String representing a single line

    public interface DiffListener<E>
    A listener that receives results from the Diff algorithm.
    Since:
    2.1
    Author:
    Chris Jennings
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void inserted​(java.lang.Object original, java.lang.Object changed, int originalIndex, E insertedelement)
      Called to indicate that an element has been inserted to create the changed sequence.
      void removed​(java.lang.Object original, java.lang.Object changed, int originalIndex, E removedelement)
      Called to indicate that an element has been removed to create the changed sequence.
      void unchanged​(java.lang.Object original, java.lang.Object changed, int originalIndex, E element)
      Called to indicate that an element was copied without change from the original to the changed sequence.
    • Method Detail

      • unchanged

        void unchanged​(java.lang.Object original,
                       java.lang.Object changed,
                       int originalIndex,
                       E element)
        Called to indicate that an element was copied without change from the original to the changed sequence.
        Parameters:
        original - the array or list that was passed to Diff.findChanges(E[], E[]) as the parameter named original
        changed - the array or list that was passed to Diff.findChanges(E[], E[]) as the parameter named changed
        originalIndex - the index in the original sequence at which this event occurs
        element - the original element
      • inserted

        void inserted​(java.lang.Object original,
                      java.lang.Object changed,
                      int originalIndex,
                      E insertedelement)
        Called to indicate that an element has been inserted to create the changed sequence.
        Parameters:
        original - the array or list that was passed to Diff.findChanges(E[], E[]) as the parameter named original
        changed - the array or list that was passed to Diff.findChanges(E[], E[]) as the parameter named changed
        originalIndex - the index in the original sequence at which this event occurs
        insertedelement - the element from the changed sequence that must be inserted
      • removed

        void removed​(java.lang.Object original,
                     java.lang.Object changed,
                     int originalIndex,
                     E removedelement)
        Called to indicate that an element has been removed to create the changed sequence.
        Parameters:
        original - the array or list that was passed to Diff.findChanges(E[], E[]) as the parameter named original
        changed - the array or list that was passed to Diff.findChanges(E[], E[]) as the parameter named changed
        originalIndex - the index in the original sequence at which this event occurs
        removedelement - the element from the changed sequence that must be inserted