Liferay 6.2-ce-ga5

com.liferay.util.diff
Class DiffUtil

java.lang.Object
  extended by com.liferay.util.diff.DiffUtil

Deprecated. As of 6.2.0, moved to DiffUtil

public class DiffUtil
extends Object

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.


Field Summary
static String CLOSE_DEL
          Deprecated.  
static String CLOSE_INS
          Deprecated.  
static String CONTEXT_LINE
          Deprecated.  
static String OPEN_DEL
          Deprecated.  
static String OPEN_INS
          Deprecated.  
 
Constructor Summary
DiffUtil()
          Deprecated.  
 
Method Summary
static List<DiffResult>[] diff(Reader source, Reader target)
          Deprecated. This is a diff method with default values.
static List<DiffResult>[] diff(Reader source, Reader target, String addedMarkerStart, String addedMarkerEnd, String deletedMarkerStart, String deletedMarkerEnd, int margin)
          Deprecated. The main entrance of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLOSE_DEL

public static final String CLOSE_DEL
Deprecated. 
See Also:
Constant Field Values

CLOSE_INS

public static final String CLOSE_INS
Deprecated. 
See Also:
Constant Field Values

CONTEXT_LINE

public static final String CONTEXT_LINE
Deprecated. 
See Also:
Constant Field Values

OPEN_DEL

public static final String OPEN_DEL
Deprecated. 
See Also:
Constant Field Values

OPEN_INS

public static final String OPEN_INS
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

DiffUtil

public DiffUtil()
Deprecated. 
Method Detail

diff

public static List<DiffResult>[] diff(Reader source,
                                      Reader target)
Deprecated. 
This is a diff method with default values.

Parameters:
source - the source text
target - the modified version of the source text
Returns:
an array containing two lists of DiffResults, the first element contains DiffResults related to changes in source and the second element to changes in target

diff

public static List<DiffResult>[] diff(Reader source,
                                      Reader target,
                                      String addedMarkerStart,
                                      String addedMarkerEnd,
                                      String deletedMarkerStart,
                                      String deletedMarkerEnd,
                                      int margin)
Deprecated. 
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 source text
target - the modified version of the source text
addedMarkerStart - the marker to indicate the start of text added to the source
addedMarkerEnd - the marker to indicate the end of text added to the source
deletedMarkerStart - the marker to indicate the start of text deleted from the source
deletedMarkerEnd - the marker to indicate the end of text deleted from the source
margin - the vertical margin to use in displaying differences between changed line changes
Returns:
an array containing two lists of DiffResults, the first element contains DiffResults related to changes in source and the second element to changes in target

Liferay 6.2-ce-ga5