| java.lang.Object org.apache.commons.jrcs.util.ToString org.apache.commons.jrcs.diff.Diff
Diff | public class Diff extends ToString (Code) | | Implements a differencing engine that works on arrays of
Object Object .
Within this library, the word text means a unit of information
subject to version control.
Text is represented as Object[] because the diff engine is
capable of handling more than plain ascci. In fact, arrays of any type that
implements
java.lang.Object.hashCode hashCode() and
java.lang.Object.equals equals() correctly can be subject to
differencing using this library.
This library provides a framework in which different differencing algorithms
may be used. If no algorithm is specififed, a default algorithm is used.
version: $Revision: 7756 $ $Date: 2006-04-12 18:30:19 +0100 (Wed, 12 Apr version: 2006) $ author: Juanco Anez See Also: Delta See Also: DiffAlgorithm See Also: modifications: 27 Apr 2003 bwm Added some comments whilst See Also: trying to figure out the algorithm 03 May 2003 bwm Factored out the See Also: algorithm implementation into a separate difference algorithm class to See Also: allow pluggable algorithms. |
Field Summary | |
final public static String | NL The standard line separator. | final public static String | RCS_EOL The line separator to use in RCS format output. | protected DiffAlgorithm | algorithm The differencing algorithm to use. | final protected Object[] | orig The original sequence. |
Method Summary | |
public static String | arrayToString(Object[] o) Converts an array of
Object Object to a string using
Diff.NL Diff.NL as the line separator. | public static boolean | compare(Object[] orig, Object[] rev) Compares the two input sequences.
Parameters: orig - The original sequence. Parameters: rev - The revised sequence. | protected DiffAlgorithm | defaultAlgorithm() | public static Revision | diff(Object[] orig, Object[] rev) compute the difference between an original and a revision.
Parameters: orig - the original Parameters: rev - the revision to compare with the original. | public static Revision | diff(Object[] orig, Object[] rev, DiffAlgorithm algorithm) compute the difference between an original and a revision. | public Revision | diff(Object[] rev) compute the difference between the original and a revision.
Parameters: rev - the revision to compare with the original. | public static Object[] | editAll(Object[] text) Edits all of the items in the input sequence.
Parameters: text - The input sequence. | public static Object[] | randomEdit(Object[] text) Performs random edits on the input sequence. | public static Object[] | randomEdit(Object[] text, long seed) Performs random edits on the input sequence. | public static Object[] | randomSequence(int size) Generate a random sequence of the given size.
Parameters: The - size of the sequence to generate. | public static Object[] | randomSequence(int size, long seed) Generate a random sequence of the given size.
Parameters: The - size of the sequence to generate. Parameters: seed - A seed value for randomizing the generation. | public static Object[] | shuffle(Object[] text) Shuffles around the items in the input sequence.
Parameters: text - The input sequence. | public static Object[] | shuffle(Object[] text, long seed) Shuffles around the items in the input sequence.
Parameters: text - The input sequence. Parameters: seed - A seed value for randomizing the suffle. |
NL | final public static String NL(Code) | | The standard line separator.
|
RCS_EOL | final public static String RCS_EOL(Code) | | The line separator to use in RCS format output.
|
orig | final protected Object[] orig(Code) | | The original sequence.
|
Diff | public Diff(Object[] original)(Code) | | Create a differencing object using the default algorithm
Parameters: the - original text that will be compared |
Diff | public Diff(Object[] original, DiffAlgorithm algorithm)(Code) | | Create a differencing object using the given algorithm
Parameters: o - the original text which will be compared against Parameters: algorithm - the difference algorithm to use. |
arrayToString | public static String arrayToString(Object[] o)(Code) | | Converts an array of
Object Object to a string using
Diff.NL Diff.NL as the line separator.
Parameters: o - the array of objects. |
compare | public static boolean compare(Object[] orig, Object[] rev)(Code) | | Compares the two input sequences.
Parameters: orig - The original sequence. Parameters: rev - The revised sequence. true if the sequences are identical. False otherwise. |
diff | public static Revision diff(Object[] orig, Object[] rev) throws DifferentiationFailedException(Code) | | compute the difference between an original and a revision.
Parameters: orig - the original Parameters: rev - the revision to compare with the original. a Revision describing the differences |
diff | public static Revision diff(Object[] orig, Object[] rev, DiffAlgorithm algorithm) throws DifferentiationFailedException(Code) | | compute the difference between an original and a revision.
Parameters: orig - the original Parameters: rev - the revision to compare with the original. Parameters: algorithm - the difference algorithm to use a Revision describing the differences |
editAll | public static Object[] editAll(Object[] text)(Code) | | Edits all of the items in the input sequence.
Parameters: text - The input sequence. A sequence of the same length with all the lines differing fromthe corresponding ones in the input. |
randomEdit | public static Object[] randomEdit(Object[] text)(Code) | | Performs random edits on the input sequence. Useful for testing.
Parameters: text - The input sequence. The sequence with random edits performed. |
randomEdit | public static Object[] randomEdit(Object[] text, long seed)(Code) | | Performs random edits on the input sequence. Useful for testing.
Parameters: text - The input sequence. Parameters: seed - A seed value for the randomizer. The sequence with random edits performed. |
randomSequence | public static Object[] randomSequence(int size)(Code) | | Generate a random sequence of the given size.
Parameters: The - size of the sequence to generate. The generated sequence. |
randomSequence | public static Object[] randomSequence(int size, long seed)(Code) | | Generate a random sequence of the given size.
Parameters: The - size of the sequence to generate. Parameters: seed - A seed value for randomizing the generation. The generated sequence. |
shuffle | public static Object[] shuffle(Object[] text)(Code) | | Shuffles around the items in the input sequence.
Parameters: text - The input sequence. The shuffled sequence. |
shuffle | public static Object[] shuffle(Object[] text, long seed)(Code) | | Shuffles around the items in the input sequence.
Parameters: text - The input sequence. Parameters: seed - A seed value for randomizing the suffle. The shuffled sequence. |
|
|