Class Diff


  • public class Diff
    extends java.lang.Object
    The Diff object generates a patch string.

    A patch string is actually a command to a stemmer telling it how to reduce a word to its root. For example, to reduce the word teacher to its root teach the patch string Db would be generated. This command tells the stemmer to delete the last 2 characters from the word teacher to reach the stem (the patch commands are applied starting from the last character in order to save

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) int DELETE  
      (package private) int INSERT  
      (package private) int[][] net  
      (package private) int NOOP  
      (package private) int REPLACE  
      (package private) int sizex  
      (package private) int sizey  
      (package private) int[][] way  
    • Constructor Summary

      Constructors 
      Constructor Description
      Diff()
      Constructor for the Diff object.
      Diff​(int ins, int del, int rep, int noop)
      Constructor for the Diff object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void apply​(java.lang.StringBuilder dest, java.lang.CharSequence diff)
      Apply the given patch string diff to the given string dest.
      java.lang.String exec​(java.lang.String a, java.lang.String b)
      Construct a patch string that transforms a to b.
      • Methods inherited from class java.lang.Object

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

      • sizex

        int sizex
      • sizey

        int sizey
      • net

        int[][] net
      • way

        int[][] way
      • INSERT

        int INSERT
      • DELETE

        int DELETE
      • REPLACE

        int REPLACE
      • NOOP

        int NOOP
    • Constructor Detail

      • Diff

        public Diff()
        Constructor for the Diff object.
      • Diff

        public Diff​(int ins,
                    int del,
                    int rep,
                    int noop)
        Constructor for the Diff object
        Parameters:
        ins - Description of the Parameter
        del - Description of the Parameter
        rep - Description of the Parameter
        noop - Description of the Parameter
    • Method Detail

      • apply

        public static void apply​(java.lang.StringBuilder dest,
                                 java.lang.CharSequence diff)
        Apply the given patch string diff to the given string dest.
        Parameters:
        dest - Destination string
        diff - Patch string
      • exec

        public java.lang.String exec​(java.lang.String a,
                                     java.lang.String b)
        Construct a patch string that transforms a to b.
        Parameters:
        a - String 1st string
        b - String 2nd string
        Returns:
        String