org.apache.commons.jrcs.rcs
Class TrunkNode

java.lang.Object
  extended by org.apache.commons.jrcs.util.ToString
      extended by org.apache.commons.jrcs.rcs.Node
          extended by org.apache.commons.jrcs.rcs.TrunkNode
All Implemented Interfaces:
java.lang.Comparable

 class TrunkNode
extends Node

Represents a node on the trunk or main branch of a version control Archive.

A TrunkNode stores the deltas between the node's revision and the previous revision; that is, when the deltas are applied to the current revision, the text of the previous revision is obtained. The rcsnext field of a TrunkNode points to the node corresponding to the previous revision.

This class is NOT thread safe.

Version:
$Id: TrunkNode.java,v 1.4 2003/10/13 07:59:46 rdonkin Exp $
Author:
Juanco Anez
See Also:
Node, Archive

Field Summary
 
Fields inherited from class org.apache.commons.jrcs.rcs.Node
author, branches, child, date, dateFormat, dateFormat2K, dateFormatter, endWithNewLine, locker, log, parent, phrases, rcsnext, state, text, version
 
Constructor Summary
TrunkNode(TrunkNode other)
          Create a TrunkNode bu copying another TrunkNode.
TrunkNode(Version vernum, TrunkNode next)
          Create a TrunkNode.
 
Method Summary
 Node deltaRevision()
          Returns the Node with the version number that corresponds to the revision to be obtained after the deltas in the current node are applied.
(package private)  void newpatch0(java.util.List original, Node root)
           
 Node nextInPathTo(Version vernum, boolean soft)
          Returns the next node in the path from the current node to the node identified by the given version.
protected  void patch0(java.util.List original, boolean annotate)
          Provide the initial patch.
 void setRCSNext(Node node)
          Set the next node in the RCS logical hierarcy.
 
Methods inherited from class org.apache.commons.jrcs.rcs.Node
addBranch, compareTo, getAuthor, getBranch, getBranches, getChild, getDate, getLocker, getLog, getParent, getPhrases, getRCSNext, getState, getText, getTextLines, getTextLines, getTextLines, getTextLines, getVersion, isGhost, newBranchVersion, newNode, newNode, newpatch, nextVersion, patch, patch, pathTo, pathTo, root, setAuthor, setDate, setLocker, setLog, setState, setText, setText, toString, toString, toText, toText
 
Methods inherited from class org.apache.commons.jrcs.util.ToString
arrayToString, arrayToString, stringToArray, stringToArraya, stringToArrayold, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TrunkNode

TrunkNode(TrunkNode other)
Create a TrunkNode bu copying another TrunkNode.


TrunkNode

TrunkNode(Version vernum,
          TrunkNode next)
    throws InvalidTrunkVersionNumberException
Create a TrunkNode. The next field in a TrunkNode points to the immediate previos revision or parent.

Throws:
InvalidTrunkVersionNumberException
Method Detail

setRCSNext

public void setRCSNext(Node node)
Set the next node in the RCS logical hierarcy. Update the _parent and _child node accordingly. For a TrunkNode, the RCS-next is the immediate parent.

Overrides:
setRCSNext in class Node
Parameters:
node - The next node in the RCS logical hierarchy.

deltaRevision

public Node deltaRevision()
Description copied from class: Node
Returns the Node with the version number that corresponds to the revision to be obtained after the deltas in the current node are applied.

For a BranchNode the deltaRevision is the current revision; that is, after the deltas are applied, the text for the current revision is obtained.

For a TrunkNode the deltaRevision is the next revision; that is, after the deltas are applied, the text obtained corresponds to the next revision in the chain.

Specified by:
deltaRevision in class Node
Returns:
The node for the delta revision.

nextInPathTo

public Node nextInPathTo(Version vernum,
                         boolean soft)
                  throws NodeNotFoundException
Description copied from class: Node
Returns the next node in the path from the current node to the node identified by the given version.

Specified by:
nextInPathTo in class Node
Parameters:
vernum - The version number of the last node in the path.
soft - If true, no error is thrown if a node with the given version doesn't exist. Use soft=true to find a apth to where a new node should be added.
Returns:
The path
Throws:
NodeNotFoundException - if a node with the given version number is not reachable following the RCS-next chain from this node. If soft=false the exception is also thrown if a node with the given version number doesn't exist.
See Also:
Path

patch0

protected void patch0(java.util.List original,
                      boolean annotate)
               throws InvalidFileFormatException,
                      NodeNotFoundException,
                      PatchFailedException
Provide the initial patch. Used only for head nodes.

Parameters:
original - Where to add the patch to.
annotate - True if the lines should be annotated with version numbers.
Throws:
InvalidFileFormatException
NodeNotFoundException
PatchFailedException

newpatch0

void newpatch0(java.util.List original,
               Node root)


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