|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.jrcs.util.ToString
org.apache.commons.jrcs.rcs.Node
public abstract class Node
Ancestor to all nodes in a version control Archive.
Nodes store the deltas between two revisions of the text.
This class is NOT thread safe.
TrunkNode
,
BranchNode
,
Archive
Field Summary | |
---|---|
protected java.lang.String |
author
|
protected java.util.TreeMap |
branches
|
protected Node |
child
|
protected java.util.Date |
date
|
protected static java.text.DateFormat |
dateFormat
|
protected static java.text.DateFormat |
dateFormat2K
|
protected static java.text.Format |
dateFormatter
|
protected java.lang.String |
locker
|
protected java.lang.String |
log
|
protected Node |
parent
|
protected org.apache.commons.jrcs.rcs.Phrases |
phrases
|
protected Node |
rcsnext
|
protected java.lang.String |
state
|
protected java.lang.Object[] |
text
|
protected Version |
version
The version number for this node. |
Constructor Summary | |
---|---|
protected |
Node(Node other)
Creates a copy of a node. |
protected |
Node(Version vernum,
Node rcsnext)
Creates a node with the given version number. |
Method Summary | |
---|---|
void |
addBranch(org.apache.commons.jrcs.rcs.BranchNode node)
Adds a branch node to the current node. |
int |
compareTo(java.lang.Object other)
Compares the version number of this node to that of another node. |
abstract 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. |
java.lang.String |
getAuthor()
|
org.apache.commons.jrcs.rcs.BranchNode |
getBranch(int no)
Retrieve the branch node identified with the given numer. |
java.util.TreeMap |
getBranches()
|
Node |
getChild()
|
java.util.Date |
getDate()
|
java.lang.String |
getLocker()
|
java.lang.String |
getLog()
|
Node |
getParent()
|
org.apache.commons.jrcs.rcs.Phrases |
getPhrases()
|
Node |
getRCSNext()
Return the next node in the RCS logical hierarchy. |
java.lang.String |
getState()
|
java.lang.Object[] |
getText()
|
java.util.List |
getTextLines()
Return a list with the lines of the node's text. |
java.util.List |
getTextLines(int from,
int to)
Return a list with a subset of the lines of the node's text. |
java.util.List |
getTextLines(java.util.List lines)
Add a subset of the lines of the node's text to the given list. |
java.util.List |
getTextLines(java.util.List lines,
int from,
int to)
Add a subset of the lines of the node's text to the given list. |
Version |
getVersion()
|
boolean |
isGhost()
Returns true if the node is a "ghost" node. |
Version |
newBranchVersion()
Returns the version number that should correspond to a newly created branch of this node. |
abstract 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. |
Version |
nextVersion()
Returns the version number that should correspond to the revision folowing this node. |
void |
patch(java.util.List original)
Apply the deltas in the current node to the given text. |
void |
patch(java.util.List original,
boolean annotate)
Apply the deltas in the current node to the given text. |
org.apache.commons.jrcs.rcs.Path |
pathTo(Version vernum)
Returns the path from the current node to the node identified by the given version. |
org.apache.commons.jrcs.rcs.Path |
pathTo(Version vernum,
boolean soft)
Returns the path from the current node to the node identified by the given version. |
Node |
root()
Return the root node of the node hierarchy. |
void |
setAuthor(java.lang.String user)
Set the author of the node's revision. |
void |
setDate(int[] value)
Set the date of the node's revision. |
void |
setLocker(java.lang.String user)
Set the locker. |
void |
setLog(java.lang.String value)
Sets the log message for the node's revision. |
void |
setRCSNext(Node node)
Sets the next node in the RCS logical hierarchy. |
void |
setState(java.lang.String value)
Sets the state of the node's revision. |
void |
setText(java.lang.Object[] value)
Sets the text for the node's revision. |
void |
setText(java.lang.String value)
Sets the text for the node's revision. |
void |
toString(java.lang.StringBuffer s)
Conver the current node and all of its branches to their RCS string representation and add it to the given StringBuffer. |
void |
toString(java.lang.StringBuffer s,
java.lang.String EOL)
Conver the current node and all of its branches to their RCS string representation and add it to the given StringBuffer using the given marker as line separator. |
java.lang.String |
toText()
Conver the urrent node to its RCS string representation. |
void |
toText(java.lang.StringBuffer s,
java.lang.String EOL)
Conver the urrent node to its RCS string representation and add it to the given StringBuffer using the given marker as line separator. |
Methods inherited from class org.apache.commons.jrcs.util.ToString |
---|
arrayToString, arrayToString, stringToArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Version version
protected java.util.Date date
protected java.lang.String author
protected java.lang.String state
protected java.lang.String log
protected java.lang.String locker
protected java.lang.Object[] text
protected Node rcsnext
protected Node parent
protected Node child
protected java.util.TreeMap branches
protected org.apache.commons.jrcs.rcs.Phrases phrases
protected static final java.text.Format dateFormatter
protected static final java.text.DateFormat dateFormat
protected static final java.text.DateFormat dateFormat2K
Constructor Detail |
---|
protected Node(Node other)
other
- The node to copy.protected Node(Version vernum, Node rcsnext)
vernum
- The version number for the node.rcsnext
- The next node in the RCS logical hierarchy.Method Detail |
---|
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
other
- The node to compare two.
public boolean isGhost()
public org.apache.commons.jrcs.rcs.BranchNode getBranch(int no)
no
- The branch number.
BranchNode
public Node root()
public void setLocker(java.lang.String user)
user
- A symbol that identifies the locker.public void setAuthor(java.lang.String user)
user
- A symbol that identifies the author.public void setDate(int[] value)
value
- an array of 6 integers, corresponding to the
year, month, day, hour, minute, and second of this revision.public void setState(java.lang.String value)
value
- A symbol that identifies the state. The most commonly
used value is Exp.public void setRCSNext(Node node)
TrunkNode
points
to the previous revision, while a BranchNode
points to the next revision.
node
- The next node in the RCS logical hierarchy.public void setLog(java.lang.String value)
value
- The message.public void setText(java.lang.String value)
For archives containing binary information, the text is an image of the revision contents.
For ASCII archives, the text contains the delta between the current revision and the next revision in the RCS logical hierarchy. The deltas are codified in a format similar to the one used by Unix diff.
The passed string is converted to an array of objects befored being stored as the revision's text
value
- The revision's text.ArchiveParser
public void setText(java.lang.Object[] value)
For archives containing binary information, the text is an image of the revision contents.
For ASCII archives, the text contains the delta between the current revision and the next revision in the RCS logical hierarchy. The deltas are codified in a format similar to the one used by Unix diff.
value
- The revision's text.ArchiveParser
public void addBranch(org.apache.commons.jrcs.rcs.BranchNode node) throws InvalidVersionNumberException
node
- The branch node.
InvalidVersionNumberException
- if the version number
is not a valid branch version number for the current nodepublic Version nextVersion()
public Version newBranchVersion()
public Node getRCSNext()
public org.apache.commons.jrcs.rcs.Path pathTo(Version vernum) throws NodeNotFoundException
vernum
- The version number of the last node in the path.
NodeNotFoundException
- if a node with the given version number
doesn't exist, or is not reachable following the RCS-next chain
from this node.Path
public org.apache.commons.jrcs.rcs.Path pathTo(Version vernum, boolean soft) throws NodeNotFoundException
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.
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.Path
public abstract Node nextInPathTo(Version vernum, boolean soft) throws NodeNotFoundException
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.
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.Path
public abstract Node deltaRevision()
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.
public void patch(java.util.List original) throws InvalidFileFormatException, PatchFailedException
original
- the text to be patched
InvalidFileFormatException
- if the deltas cannot be parsed.
PatchFailedException
- if the diff engine determines that
the deltas cannot apply to the given text.public void patch(java.util.List original, boolean annotate) throws InvalidFileFormatException, PatchFailedException
original
- the text to be patchedannotate
- set to true to have each text line be a
Line
object that identifies the revision in which
the line was changed or added.
InvalidFileFormatException
- if the deltas cannot be parsed.
PatchFailedException
- if the diff engine determines that
the deltas cannot apply to the given text.public void toString(java.lang.StringBuffer s)
toString
in class ToString
s
- The string buffer to add the node's image to.public void toString(java.lang.StringBuffer s, java.lang.String EOL)
s
- The string buffer to add the node's image to.EOL
- The line separator to use.public java.lang.String toText()
public void toText(java.lang.StringBuffer s, java.lang.String EOL)
s
- The string buffer to add the node's image to.EOL
- The line separator to use.public java.util.List getTextLines()
public java.util.List getTextLines(int from, int to)
from
- The offset of the first line to retrieve.to
- The offset of the line after the last one to retrieve.
public java.util.List getTextLines(java.util.List lines)
public java.util.List getTextLines(java.util.List lines, int from, int to)
from
- The offset of the first line to retrieve.to
- The offset of the line after the last one to retrieve.
public final java.util.Date getDate()
public final java.lang.String getAuthor()
public final java.lang.String getState()
public final java.lang.String getLog()
public final java.lang.String getLocker()
public final java.lang.Object[] getText()
public final Node getChild()
public final java.util.TreeMap getBranches()
public final Node getParent()
public final Version getVersion()
public org.apache.commons.jrcs.rcs.Phrases getPhrases()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |