com.liferay.util.diff
Class DiffUtil

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

Deprecated. This class has been repackaged at com.liferay.portal.kernel.util.

public class DiffUtil
extends java.lang.Object

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

Field Summary
static java.lang.String CLOSE_DEL
          Deprecated.  
static java.lang.String CLOSE_INS
          Deprecated.  
static java.lang.String CONTEXT_LINE
          Deprecated.  
static java.lang.String OPEN_DEL
          Deprecated.  
static java.lang.String OPEN_INS
          Deprecated.  
 
Constructor Summary
DiffUtil()
          Deprecated.  
 
Method Summary
static java.util.List<DiffResult>[] diff(java.io.Reader source, java.io.Reader target)
          Deprecated. This is a diff method with default values.
static java.util.List<DiffResult>[] diff(java.io.Reader source, java.io.Reader target, java.lang.String addedMarkerStart, java.lang.String addedMarkerEnd, java.lang.String deletedMarkerStart, java.lang.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

OPEN_INS

public static final java.lang.String OPEN_INS
Deprecated. 
See Also:
Constant Field Values

CLOSE_INS

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

OPEN_DEL

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

CLOSE_DEL

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

CONTEXT_LINE

public static final java.lang.String CONTEXT_LINE
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

DiffUtil

public DiffUtil()
Deprecated. 
Method Detail

diff

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

Parameters:
source - the Reader of the source text
target - the Reader of the target 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 java.util.List<DiffResult>[] diff(java.io.Reader source,
                                                java.io.Reader target,
                                                java.lang.String addedMarkerStart,
                                                java.lang.String addedMarkerEnd,
                                                java.lang.String deletedMarkerStart,
                                                java.lang.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 Reader of the source text, this can be for example, an instance of FileReader or StringReader
target - the Reader of the target text
addedMarkerStart - the initial marker for highlighting additions
addedMarkerEnd - the end marker for highlighting additions
deletedMarkerStart - the initial marker for highlighting removals
deletedMarkerEnd - the end marker for highlighting removals
margin - the number of lines that will be added before the first changed line
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