org.apache.commons.jrcs.rcs
Class BranchNode

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.BranchNode
All Implemented Interfaces:
java.lang.Comparable

 class BranchNode
extends Node

Represents a branch node in a version control archive. This class is NOT thread safe.

A BranchNode stores the deltas between the previous revision and the current revision; that is, when the deltas are applied to the previous revision, the text of the current revision is obtained. The rcsnext field of a BranchNode points to the next revision in the branch.

Version:
$Id: BranchNode.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
BranchNode(Version vernum, BranchNode next)
          Create a BranchNode with the given version number.
 
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.
 BranchNode getLeafNode()
          Return the last (leaf) node in the branch this node belongs to.
 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.
 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

BranchNode

BranchNode(Version vernum,
           BranchNode next)
Create a BranchNode with the given version number. The next field in a Branch node points to the next higher revision on the same branch.

Parameters:
vernum - the version number for the node
next - the next node in the logical RCS hierarchy.
Method Detail

getLeafNode

public BranchNode getLeafNode()
Return the last (leaf) node in the branch this node belongs to.

Returns:
The leaf node.

setRCSNext

public void setRCSNext(Node node)
Set the next node in the RCS logical hierarcy. Update the _parent and _child node accordingly. For BranchNodes, the RCS-next is a child, that is, a node with a larger version number.

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


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