org.apache.commons.jrcs.rcs
Class Path

java.lang.Object
  extended by org.apache.commons.jrcs.rcs.Path

 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.4 2003/10/13 07:59:46 rdonkin Exp $
Author:
Juanco Anez
See Also:
Archive, Node

Field Summary
private  java.util.List<Node> path
           
 
Constructor Summary
Path()
          Creates an empty Path
 
Method Summary
 void add(Node node)
          Add a node to the Path.
 Node last()
          Return the last node in the path or null if the path is empty.
 java.util.List newpatch(java.util.List<Line> lines, boolean annotate)
           
 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<Node> 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.

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

newpatch

public java.util.List newpatch(java.util.List<Line> lines,
                               boolean annotate)
                        throws InvalidFileFormatException,
                               PatchFailedException
Throws:
InvalidFileFormatException
PatchFailedException


Copyright 2002 the Apache Software Foundation
Copyright ? 1999-2001 Juancarlo A?ez, Caracas, Venezuela.
All rights reserved
. http://www.suigeneris.org/jrcs