java.lang.Object
org.apache.wicket.util.diff.ToString
org.apache.wicket.util.diff.Delta
- Direct Known Subclasses:
AddDelta
,ChangeDelta
,DeleteDelta
Holds a "delta" difference between to revisions of a text.
- Version:
- $Revision: 1.1 $ $Date: 2006/03/12 00:24:21 $
- Author:
- Juanco Anez, Brian McBride
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
accept
(RevisionVisitor visitor) Accepts a visitor.abstract void
Applies this delta as a patch to the given text.Accessor method to return the chunk representing the original sequence of itemsAccessor method to return the chunk representing the updated sequence of items.protected void
Initializes the delta with the given chunks from the original and revised texts.static Delta
Returns a Delta that corresponds to the given chunks in the original and revised text respectively.final void
Applies this delta as a patch to the given text.toRCSString
(String EOL) Converts this delta into its RCS style string representation.abstract void
toRCSString
(StringBuilder s, String EOL) Converts this delta into its RCS style string representation.void
Converts this delta into its Unix diff style string representation.abstract void
Verifies that this delta can be used to patch the given text.Methods inherited from class org.apache.wicket.util.diff.ToString
arrayToString, arrayToString, stringToArray, toString
-
Field Details
-
original
-
revised
-
-
Constructor Details
-
Delta
protected Delta()Creates an uninitialized delta. -
Delta
Creates a delta object with the given chunks from the original and revised texts.- Parameters:
orig
-rev
-
-
-
Method Details
-
newDelta
Returns a Delta that corresponds to the given chunks in the original and revised text respectively.- Parameters:
orig
- the chunk in the original text.rev
- the chunk in the revised text.- Returns:
- Delta
-
init
Initializes the delta with the given chunks from the original and revised texts.- Parameters:
orig
-rev
-
-
verify
Verifies that this delta can be used to patch the given text.- Parameters:
target
- the text to patch.- Throws:
PatchFailedException
- if the patch cannot be applied.
-
patch
Applies this delta as a patch to the given text.- Parameters:
target
- the text to patch.- Throws:
PatchFailedException
- if the patch cannot be applied.
-
applyTo
Applies this delta as a patch to the given text.- Parameters:
target
- the text to patch.
-
toString
Converts this delta into its Unix diff style string representation.- Overrides:
toString
in classToString
- Parameters:
s
- aStringBuffer
to which the string representation will be appended.
-
toRCSString
Converts this delta into its RCS style string representation.- Parameters:
s
- aStringBuffer
to which the string representation will be appended.EOL
- the string to use as line separator.
-
toRCSString
Converts this delta into its RCS style string representation.- Parameters:
EOL
- the string to use as line separator.- Returns:
- String
-
getOriginal
Accessor method to return the chunk representing the original sequence of items- Returns:
- the original sequence
-
getRevised
Accessor method to return the chunk representing the updated sequence of items.- Returns:
- the updated sequence
-
accept
Accepts a visitor.See the Visitor pattern in "Design Patterns" by the GOF4.
- Parameters:
visitor
- The visitor.
-