Class Patch<T>

  • Type Parameters:
    T - The type of the compared elements in the 'lines'.

    public class Patch<T>
    extends java.lang.Object
    Copy from https://code.google.com/p/java-diff-utils/.

    Describes the patch holding all deltas between the original and revised texts.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<Delta<T>> deltas  
    • Constructor Summary

      Constructors 
      Constructor Description
      Patch()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addDelta​(Delta<T> delta)
      Add the given delta to this patch
      java.util.List<T> applyTo​(java.util.List<T> target)
      Apply this patch to the given target
      java.util.List<Delta<T>> getDeltas()
      Get the list of computed deltas
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • deltas

        private java.util.List<Delta<T>> deltas
    • Constructor Detail

      • Patch

        public Patch()
    • Method Detail

      • applyTo

        public java.util.List<T> applyTo​(java.util.List<T> target)
                                  throws java.lang.IllegalStateException
        Apply this patch to the given target
        Parameters:
        target - the list to patch
        Returns:
        the patched text
        Throws:
        java.lang.IllegalStateException - if can't apply patch
      • addDelta

        public void addDelta​(Delta<T> delta)
        Add the given delta to this patch
        Parameters:
        delta - the given delta
      • getDeltas

        public java.util.List<Delta<T>> getDeltas()
        Get the list of computed deltas
        Returns:
        the deltas