org.suigeneris.jrcs.rcs.impl
Class Path

java.lang.Object
  extended by org.suigeneris.jrcs.rcs.impl.Path

public class Path
extends java.lang.Object

A path from the head revision to a given revision in an Archive. Path collaborates with Node in applying the set of deltas contained in archive nodes to arrive at the text of the revision corresponding to the last node in the path. This class is NOT thread safe.

Version:
$Id: Path.java,v 1.2 2006/06/08 18:17:11 juanca Exp $
Author:
Juanco Anez
See Also:
Archive, Node

Field Summary
private  java.util.List path
           
 
Constructor Summary
Path()
          Creates an empty Path
 
Method Summary
 void add(Node node)
          Add a node to the Path.
 Node beforeLast()
          Return the node before the last in the path.
 Node last()
          Return the last node in the path or null if the path is empty.
 java.util.List patch()
          Returns the text that corresponds to applying the patches in the list of nodes in the Path.
 java.util.List patch(boolean annotate)
          Returns the text that corresponds to applying the patches in the list of nodes in the Path.
 java.util.List patch(java.util.List lines)
          Returns the text that corresponds to applying the patches in the list of nodes in the Path.
 java.util.List patch(java.util.List lines, boolean annotate)
          Returns the text that corresponds to applying the patches in the list of nodes in the Path.
 int size()
          The size of the Path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

path

private java.util.List path
Constructor Detail

Path

public Path()
Creates an empty Path

Method Detail

add

public void add(Node node)
Add a node to the Path.

Parameters:
node - The Node to add.

size

public int size()
The size of the Path.

Returns:
The size of the Path

last

public Node last()
Return the last node in the path or null if the path is empty.

Returns:
the last node in the path or null if the path is empty.

beforeLast

public Node beforeLast()
Return the node before the last in the path.

Returns:
the node before the last in the path or null unavailable.

patch

public java.util.List patch()
                     throws InvalidFileFormatException,
                            PatchFailedException,
                            NodeNotFoundException
Returns the text that corresponds to applying the patches in the list of nodes in the Path. Assume that the text of the first node is plaintext and not deltatext.

Returns:
The resulting text after the patches
Throws:
InvalidFileFormatException
PatchFailedException
NodeNotFoundException

patch

public java.util.List patch(boolean annotate)
                     throws InvalidFileFormatException,
                            PatchFailedException,
                            NodeNotFoundException
Returns the text that corresponds to applying the patches in the list of nodes in the Path. Assume that the text of the first node is plaintext and not deltatext.

Parameters:
annotate - if true, then each text line is a Line with the original text annotated with the revision in which it was last changed or added.
Returns:
The resulting text after the patches
Throws:
InvalidFileFormatException
PatchFailedException
NodeNotFoundException

patch

public java.util.List patch(java.util.List lines)
                     throws InvalidFileFormatException,
                            PatchFailedException,
                            NodeNotFoundException
Returns the text that corresponds to applying the patches in the list of nodes in the Path. Assume that the text of the first node is plaintext and not deltatext.

Parameters:
lines - The list to where the text must be added and the patches applied. Line with the original text annotated with the revision in which it was last changed or added.
Returns:
The resulting text after the patches
Throws:
InvalidFileFormatException
PatchFailedException
NodeNotFoundException

patch

public java.util.List patch(java.util.List lines,
                            boolean annotate)
                     throws InvalidFileFormatException,
                            PatchFailedException,
                            NodeNotFoundException
Returns the text that corresponds to applying the patches in the list of nodes in the Path. Assume that the text of the first node is plaintext and not deltatext.

Parameters:
lines - The list to where the text must be added and the patches applied.
annotate - if true, then each text line is a Line with the original text annotated with the revision in which it was last changed or added.
Returns:
The resulting text after the patches
Throws:
InvalidFileFormatException
PatchFailedException
NodeNotFoundException


Copyright © 1999-2006 Juancarlo Añez, Caracas, Venezuela.
Some rights reserved
. http://www.suigeneris.org/jrcs