|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.util.diff.ToString org.apache.wicket.util.diff.Diff
public class Diff
Implements a differencing engine that works on arrays of 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 hashCode()
and 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 specified, a default algorithm is used.
Delta
,
modifications:
27 Apr 2003 bwm
Added some comments whilst trying to figure out the algorithm
03 May 2003 bwm
Factored out the algorithm implementation into a separate difference algorithm class to
allow pluggable algorithms.
Field Summary | |
---|---|
protected DiffAlgorithm |
algorithm
The differencing algorithm to use. |
static String |
NL
The standard line separator. |
protected Object[] |
orig
The original sequence. |
static String |
RCS_EOL
The line separator to use in RCS format output. |
Constructor Summary | |
---|---|
Diff(Object[] original)
Create a differencing object using the default algorithm |
|
Diff(Object[] original,
DiffAlgorithm algorithm)
Create a differencing object using the given algorithm |
Method Summary | |
---|---|
static String |
arrayToString(Object[] o)
Converts an array of Object to a string using Diff.NL as the
line separator. |
static boolean |
compare(Object[] orig,
Object[] rev)
Compares the two input sequences. |
protected DiffAlgorithm |
defaultAlgorithm()
|
Revision |
diff(Object[] rev)
compute the difference between the original and a revision. |
static Revision |
diff(Object[] orig,
Object[] rev)
compute the difference between an original and a revision. |
static Revision |
diff(Object[] orig,
Object[] rev,
DiffAlgorithm algorithm)
compute the difference between an original and a revision. |
static Object[] |
editAll(Object[] text)
Edits all of the items in the input sequence. |
static Object[] |
randomEdit(Object[] text)
Performs random edits on the input sequence. |
static Object[] |
randomEdit(Object[] text,
long seed)
Performs random edits on the input sequence. |
static Object[] |
randomSequence(int size)
Generate a random sequence of the given size. |
static Object[] |
randomSequence(int size,
long seed)
Generate a random sequence of the given size. |
static Object[] |
shuffle(Object[] text)
Shuffles around the items in the input sequence. |
static Object[] |
shuffle(Object[] text,
long seed)
Shuffles around the items in the input sequence. |
Methods inherited from class org.apache.wicket.util.diff.ToString |
---|
arrayToString, stringToArray, toString, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String NL
public static final String RCS_EOL
protected final Object[] orig
protected DiffAlgorithm algorithm
Constructor Detail |
---|
public Diff(Object[] original)
original
- the original text that will be comparedpublic Diff(Object[] original, DiffAlgorithm algorithm)
original
- the original text that will be comparedalgorithm
- the difference algorithm to use.Method Detail |
---|
protected DiffAlgorithm defaultAlgorithm()
public static Revision diff(Object[] orig, Object[] rev) throws DifferentiationFailedException
orig
- the originalrev
- the revision to compare with the original.
DifferentiationFailedException
public static Revision diff(Object[] orig, Object[] rev, DiffAlgorithm algorithm) throws DifferentiationFailedException
orig
- the originalrev
- the revision to compare with the original.algorithm
- the difference algorithm to use
DifferentiationFailedException
public Revision diff(Object[] rev) throws DifferentiationFailedException
rev
- the revision to compare with the original.
DifferentiationFailedException
public static boolean compare(Object[] orig, Object[] rev)
orig
- The original sequence.rev
- The revised sequence.
public static String arrayToString(Object[] o)
Object
to a string using Diff.NL
as the
line separator.
o
- the array of objects.
public static Object[] editAll(Object[] text)
text
- The input sequence.
public static Object[] randomEdit(Object[] text)
text
- The input sequence.
public static Object[] randomEdit(Object[] text, long seed)
text
- The input sequence.seed
- A seed value for the randomizer.
public static Object[] shuffle(Object[] text)
text
- the input sequence.
public static Object[] shuffle(Object[] text, long seed)
text
- the input sequence.seed
- a seed value for randomizing the generation.
public static Object[] randomSequence(int size)
size
- the size of the sequence to generate.
public static Object[] randomSequence(int size, long seed)
size
- the size of the sequence to generate.seed
- a seed value for randomizing the generation.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |