| java.lang.Object com.liferay.util.diff.DiffUtil
DiffUtil | public class DiffUtil (Code) | | View Source
This class can compare two different versions of a text. Source refers to
the earliest version of the text and target refers to a modified version of
source. Changes are considered either as a removal from the source or as an
addition to the target. This class detects changes to an entire line and also
detects changes within lines, such as, removal or addition of characters.
Take a look at DiffTest to see the expected inputs and outputs.
author: Bruno Farache |
diff | public static List[] diff(Reader source, Reader target)(Code) | | This is a diff method with default values.
Parameters: source - the Reader of the source text Parameters: target - the Reader of the target text an array containing two lists of DiffResults ,the first element contains DiffResults related to changesin source and the second element to changes in target |
diff | public static List[] diff(Reader source, Reader target, String addedMarkerStart, String addedMarkerEnd, String deletedMarkerStart, String deletedMarkerEnd, int margin)(Code) | | The main entrance of this class. This method will compare the two texts,
highlight the changes by enclosing them with markers and return a list
of DiffResults .
Parameters: source - the Reader of the source text, this canbe for example, an instance of FileReader or StringReader Parameters: target - the Reader of the target text Parameters: addedMarkerStart - the initial marker for highlightingadditions Parameters: addedMarkerEnd - the end marker for highlighting additions Parameters: deletedMarkerStart - the initial marker for highlightingremovals Parameters: deletedMarkerEnd - the end marker for highlighting removals Parameters: margin - the number of lines that will be added before thefirst changed line an array containing two lists of DiffResults ,the first element contains DiffResults related to changesin source and the second element to changes in target |
|
|