org.apache.wicket.util.diff
Class Revision

java.lang.Object
  extended by org.apache.wicket.util.diff.ToString
      extended by org.apache.wicket.util.diff.Revision

public class Revision
extends ToString

A Revision holds the series of deltas that describe the differences between two sequences.

Version:
$Revision: 1.1 $ $Date: 2006/03/12 00:24:21 $
Author:
Juanco Anez, Brian McBride
See Also:
Delta, Diff, Chunk, modifications 27 Apr 2003 bwm Added visitor pattern Visitor interface and accept() method.

Constructor Summary
Revision()
          Creates an empty Revision.
 
Method Summary
 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(StringBuffer s)
          Converts this revision into its RCS style string representation.
 void toRCSString(StringBuffer s, String EOL)
          Converts this revision into its RCS style string representation.
 void toString(StringBuffer s)
          Converts this revision into its Unix diff style string representation.
 
Methods inherited from class org.apache.wicket.util.diff.ToString
arrayToString, arrayToString, stringToArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Revision

public Revision()
Creates an empty Revision.

Method Detail

addDelta

public void addDelta(Delta delta)
Adds a delta to this revision.

Parameters:
delta - the Delta to add.

insertDelta

public void insertDelta(Delta delta)
Adds a delta to the start of this revision.

Parameters:
delta - the Delta to add.

getDelta

public Delta getDelta(int i)
Retrieves a delta from this revision by position.

Parameters:
i - the position of the delta to retrieve.
Returns:
the specified delta

size

public int size()
Returns the number of deltas in this revision.

Returns:
the number of deltas.

patch

public Object[] patch(Object[] src)
               throws PatchFailedException
Applies the series of deltas in this revision as patches to the given text.

Parameters:
src - the text to patch, which the method doesn't change.
Returns:
the resulting text after the patches have been applied.
Throws:
PatchFailedException - if any of the patches cannot be applied.

applyTo

public void applyTo(List<Object> target)
             throws PatchFailedException
Applies the series of deltas in this revision as patches to the given text.

Parameters:
target - the text to patch.
Throws:
PatchFailedException - if any of the patches cannot be applied.

toString

public void toString(StringBuffer s)
Converts this revision into its Unix diff style string representation.

Overrides:
toString in class ToString
Parameters:
s - a StringBuffer to which the string representation will be appended.

toRCSString

public void toRCSString(StringBuffer s,
                        String EOL)
Converts this revision into its RCS style string representation.

Parameters:
s - a StringBuffer to which the string representation will be appended.
EOL - the string to use as line separator.

toRCSString

public void toRCSString(StringBuffer s)
Converts this revision into its RCS style string representation.

Parameters:
s - a StringBuffer to which the string representation will be appended.

toRCSString

public String toRCSString(String EOL)
Converts this delta into its RCS style string representation.

Parameters:
EOL - the string to use as line separator.
Returns:
String

toRCSString

public String toRCSString()
Converts this delta into its RCS style string representation using the default line separator.

Returns:
String

accept

public void accept(RevisionVisitor visitor)
Accepts a visitor.

Parameters:
visitor - the RevisionVisitor visiting this instance


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.