public class Revision extends ToString
Delta
,
Diff
,
Chunk
,
modifications 27 Apr 2003 bwm
Added visitor pattern Visitor interface and accept() method.
Constructor and Description |
---|
Revision()
Creates an empty Revision.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(RevisionVisitor visitor)
Accepts a visitor.
|
void |
addDelta(Delta delta)
Adds a delta to this revision.
|
void |
applyTo(List<Object> target)
Applies the series of deltas in this revision as patches to the given text.
|
Delta |
getDelta(int i)
Retrieves a delta from this revision by position.
|
void |
insertDelta(Delta delta)
Adds a delta to the start of this revision.
|
Object[] |
patch(Object[] src)
Applies the series of deltas in this revision as patches to the given text.
|
int |
size()
Returns the number of deltas in this revision.
|
String |
toRCSString()
Converts this delta into its RCS style string representation using the default line
separator.
|
String |
toRCSString(String EOL)
Converts this delta into its RCS style string representation.
|
void |
toRCSString(StringBuilder s)
Converts this revision into its RCS style string representation.
|
void |
toRCSString(StringBuilder s,
String EOL)
Converts this revision into its RCS style string representation.
|
void |
toString(StringBuilder s)
Converts this revision into its Unix diff style string representation.
|
arrayToString, arrayToString, stringToArray, toString
public void addDelta(Delta delta)
delta
- the Delta
to add.public void insertDelta(Delta delta)
delta
- the Delta
to add.public Delta getDelta(int i)
i
- the position of the delta to retrieve.public int size()
public Object[] patch(Object[] src) throws PatchFailedException
src
- the text to patch, which the method doesn't change.PatchFailedException
- if any of the patches cannot be applied.public void applyTo(List<Object> target) throws PatchFailedException
target
- the text to patch.PatchFailedException
- if any of the patches cannot be applied.public void toString(StringBuilder s)
toString
in class ToString
s
- a StringBuffer
to which the string representation will be
appended.public void toRCSString(StringBuilder s, String EOL)
s
- a StringBuffer
to which the string representation will be
appended.EOL
- the string to use as line separator.public void toRCSString(StringBuilder s)
s
- a StringBuffer
to which the string representation will be
appended.public String toRCSString(String EOL)
EOL
- the string to use as line separator.public String toRCSString()
public void accept(RevisionVisitor visitor)
visitor
- the RevisionVisitor
visiting this instanceCopyright © 2006–2022 Apache Software Foundation. All rights reserved.