sbailliez    02/02/27 12:58:59

  Modified:    src/java/org/apache/maven/jrcs/rcs Archive.java
                        ArchiveParser.java BranchNode.java Lines.java
                        Node.java TrunkNode.java
  Log:
  More refactoring:
  - Encapsulate fields
  - remove _ coding style
  
  Revision  Changes    Path
  1.16      +42 -42    
jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Archive.java
  
  Index: Archive.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Archive.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Archive.java      27 Feb 2002 20:05:00 -0000      1.15
  +++ Archive.java      27 Feb 2002 20:58:58 -0000      1.16
  @@ -80,9 +80,9 @@
   /**
    * Handling of RCS/CVS version control archives.
    * This class is NOT thread safe.
  - * 
  + *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Juanco Anez</a>
  - * @version $Id: Archive.java,v 1.15 2002/02/27 20:05:00 juanco Exp $
  + * @version $Id: Archive.java,v 1.16 2002/02/27 20:58:58 sbailliez Exp $
    */
   public class Archive
           extends ToString
  @@ -224,7 +224,7 @@
           }
       }
   
  -    
  +
       /**
        * Add a head node with the given version number.
        * @param vernum The version number to use.
  @@ -233,7 +233,7 @@
       {
           if (head != null)
           {
  -            throw new HeadAlreadySetException(head.version);
  +            throw new HeadAlreadySetException(head.getVersion());
           }
           head = new TrunkNode(vernum, null);
           nodes.put(vernum, head);
  @@ -241,7 +241,7 @@
   
   
       /**
  -     * Set the active branch to the one identified by the given version number. 
  +     * Set the active branch to the one identified by the given version number.
        * Incomplete version numbers of the form "1" or "2.1.3" are accepted.
        * @param v The version number.
        */
  @@ -250,9 +250,9 @@
           setBranch(new Version(v));
       }
   
  -    
  +
       /**
  -     * Set the active branch to the one identified by the given version number. 
  +     * Set the active branch to the one identified by the given version number.
        * @param vernum The version number.
        */
       public void setBranch(Version vernum) throws InvalidBranchVersionNumberException
  @@ -261,9 +261,9 @@
           {
               throw new InvalidBranchVersionNumberException(vernum);
           }
  -        if (head == null || vernum.getBase(2).isGreaterThan(head.version))
  +        if (head == null || vernum.getBase(2).isGreaterThan(head.getVersion()))
           {
  -            throw new InvalidBranchVersionNumberException(vernum + "is greater than 
_head version " + head.version);
  +            throw new InvalidBranchVersionNumberException(vernum + "is greater than 
_head version " + head.getVersion());
           }
           branch = vernum;
       }
  @@ -280,7 +280,7 @@
        * Tag a given version with a symbol.
        * @param sym The tag.
        * @param vernum The version to tag.
  -     */    
  +     */
       public void addSymbol(String sym, Version vernum) throws 
InvalidVersionNumberException
       {
           //@TODO: verify if the symbol is valid, i.e., an identifier.
  @@ -310,7 +310,7 @@
           }
       }
   
  -           
  +
       /**
        * Set the strict locking flag for the archive.
        * @param value Indicates if strict locking should be on or off.
  @@ -338,7 +338,7 @@
           expand = value;
       }
   
  -    
  +
       /**
        * Set the archive's comment.
        * @param value The comment.
  @@ -359,7 +359,7 @@
       }
   
       /**
  -     * Add a new phrase to the archive. 
  +     * Add a new phrase to the archive.
        * Phrases are used to provide for extensions of the archive format.
        * Each phrase has a key and a list of values associated with it.
        * @param key The phrases key.
  @@ -492,7 +492,7 @@
       /**
        * Returns the path from the head node to the node identified
        * by the given version number.
  -     * @param vernum The version number that identifies the final node. 
  +     * @param vernum The version number that identifies the final node.
        * Partial version numbers are OK.
        * @return The path to the node, or null if not found.
        */
  @@ -510,7 +510,7 @@
               {
                   return null;
               }
  -            if (revisionFound.version.isLessThan(vernum))
  +            if (revisionFound.getVersion().isLessThan(vernum))
               {
                   return null;
               }
  @@ -522,23 +522,23 @@
           }
       }
   
  -    /** 
  +    /**
        * Return the actual revision number of the node identified
        * by the given version number.
  -     * @param vernum The version number that identifies the node. 
  +     * @param vernum The version number that identifies the node.
        * Partial version numbers are OK.
        * @return The actual version, or null if a node is not found.
        */
       public Version getRevisionVersion(Version vernum)
       {
           Path path = getRevisionPath(vernum);
  -        return (path == null ? null : path.last().version);
  +        return (path == null ? null : path.last().getVersion());
       }
   
  -    /** 
  +    /**
        * Return the actual revision number of the node identified
        * by the given version number.
  -     * @param vernum The version number that identifies the node. 
  +     * @param vernum The version number that identifies the node.
        * Partial version numbers are OK.
        * @return The actual version, or null if a node is not found.
        */
  @@ -547,9 +547,9 @@
           return getRevisionVersion(new Version(vernum));
       }
   
  -    /** 
  +    /**
        * Return the actual revision number of the active revision.
  -     * The revision will be the tip of the branch identified as 
  +     * The revision will be the tip of the branch identified as
        * active, or the head revision of the trunk if no branch is set
        * as active.
        * @return The version number of the active revision, or null if
  @@ -563,7 +563,7 @@
           }
           else if (head != null)
           {
  -            return head.version;
  +            return head.getVersion();
           }
           else
           {
  @@ -586,7 +586,7 @@
           if (head != null)
           {
               s.append("\t");
  -            head.version.toString(s);
  +            head.getVersion().toString(s);
           }
           s.append(EOI);
   
  @@ -620,7 +620,7 @@
           s.append("locks");
           for (Iterator i = locked.iterator(); i.hasNext();)
           {
  -            String locker = ((Node) i.next())._locker;
  +            String locker = ((Node) i.next()).getLocker();
               s.append(NLT);
               s.append(locker);
           }
  @@ -653,7 +653,7 @@
           for (Iterator i = nodes.values().iterator(); i.hasNext();)
           {
               Node n = (Node) i.next();
  -            if (!n.version.isGhost() && n._text != null)
  +            if (!n.getVersion().isGhost() && n.getText() != null)
               {
                   n.toString(s, EOL);
               }
  @@ -709,7 +709,7 @@
       /**
        * Unquote a 8string quoted in RCS style.
        * @param s the quoted string.
  -     * @param removeExtremes Determines if the enclosing @ quotes 
  +     * @param removeExtremes Determines if the enclosing @ quotes
        * should be removed.
        * @return s the string unquoted.
        */
  @@ -767,7 +767,7 @@
           }
           else if (head != null)
           {
  -            return getRevision(head.version);
  +            return getRevision(head.getVersion());
           }
           else
           {
  @@ -870,7 +870,7 @@
           }
           else
           {
  -            return addRevision(text, head.version.next(), log);
  +            return addRevision(text, head.getVersion().next(), log);
           }
       }
   
  @@ -921,13 +921,13 @@
           Path path = head.pathTo(vernum, true);
           Node target = path.last();
   
  -        if (vernum.size() < target.version.size())
  +        if (vernum.size() < target.getVersion().size())
           {
               vernum = target.nextVersion();
           }
  -        else if (!vernum.isGreaterThan(target.version))
  +        else if (!vernum.isGreaterThan(target.getVersion()))
           {
  -            throw new InvalidVersionNumberException(vernum + " revision must be 
higher than " + target.version);
  +            throw new InvalidVersionNumberException(vernum + " revision must be 
higher than " + target.getVersion());
           }
           else if (vernum.odd())
           {
  @@ -951,7 +951,7 @@
           String deltaText;
           if (headAdd)
           {
  -            deltaText = Diff.diff(text, head._text).toRCSString();
  +            deltaText = Diff.diff(text, head.getText()).toRCSString();
           }
           else
           {
  @@ -975,7 +975,7 @@
           { // adding a branch node
               newNode = newNode(vernum);
               newNode.setText(deltaText);
  -            if (vernum.size() > target.version.size())
  +            if (vernum.size() > target.getVersion().size())
               {
                   target.addBranch((BranchNode) newNode);
               }
  @@ -985,10 +985,10 @@
               }
           }
           newNode.setLog(log);
  -        return newNode.version;
  +        return newNode.getVersion();
       }
   
  - 
  +
       /**
        * Returns the given text with values added to CVS-style keywords.
        * @param text the text on which substitutions will be applied.
  @@ -1006,11 +1006,11 @@
           Object[] revisionInfo = new Object[]{
               filename,
               new File(filename).getName(),
  -            rev.version.toString(),
  -            rev._date,
  -            rev._author,
  -            rev._state,
  -            rev._locker
  +            rev.getVersion().toString(),
  +            rev.getDate(),
  +            rev.getAuthor(),
  +            rev.getState(),
  +            rev.getLocker()
           };
   
           Object[] result = new Object[text.length];
  @@ -1022,7 +1022,7 @@
       }
   
       /**
  -     * Returns the given text removing the values of any CVS-style 
  +     * Returns the given text removing the values of any CVS-style
        * keywords.
        * @param text the text on which substitutions will be applied.
        * @return the text with substitutions performed.
  
  
  
  1.7       +4 -4      
jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/ArchiveParser.java
  
  Index: ArchiveParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/ArchiveParser.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ArchiveParser.java        27 Feb 2002 16:49:48 -0000      1.6
  +++ ArchiveParser.java        27 Feb 2002 20:58:58 -0000      1.7
  @@ -63,9 +63,9 @@
   /**
    * Parses an RCS/CVS style version control archive into an Archive.
    * This class is NOT thread safe.
  - * 
  + *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Juanco Anez</a>
  - * @version $Id: ArchiveParser.java,v 1.6 2002/02/27 16:49:48 juanco Exp $
  + * @version $Id: ArchiveParser.java,v 1.7 2002/02/27 20:58:58 sbailliez Exp $
    * @see Archive
    */
   class ArchiveParser implements ArchiveParserConstants
  @@ -530,7 +530,7 @@
                   ;
           }
           jj_consume_token(29);
  -        newPhrases(node._phrases);
  +        newPhrases(node.getPhrases());
       }
   
       final public void text(Archive arc) throws ParseException
  @@ -544,7 +544,7 @@
           jj_consume_token(LOG);
           log = string();
           node.setLog(log);
  -        newPhrases(node._phrases);
  +        newPhrases(node.getPhrases());
           jj_consume_token(TEXT);
           txt = string();
           node.setText(txt);
  
  
  
  1.9       +14 -14    
jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/BranchNode.java
  
  Index: BranchNode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/BranchNode.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BranchNode.java   27 Feb 2002 20:48:43 -0000      1.8
  +++ BranchNode.java   27 Feb 2002 20:58:58 -0000      1.9
  @@ -59,20 +59,20 @@
    * Represents a branch node in a version control archive.
    * This class is NOT thread safe.
    *
  - * <p>A {@linkplain BranchNode 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. 
  + * <p>A {@linkplain BranchNode 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 {@linkplain Node._rcsnext rcsnext} field of a BranchNode points to
    * the next revision in the branch.
    * </p>
    *
    * @see Node
    * @see Archive
  - * 
  + *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Juanco Anez</a>
  - * @version $Id: BranchNode.java,v 1.8 2002/02/27 20:48:43 juanco Exp $
  + * @version $Id: BranchNode.java,v 1.9 2002/02/27 20:58:58 sbailliez Exp $
    */
  -class BranchNode 
  +class BranchNode
           extends Node
   {
       /**
  @@ -80,7 +80,7 @@
        * The next field in a Branch node points to the next higher
        * revision on the same branch.
        * @param vernum the version number for the node
  -     * @param next   the next node in the logical RCS hierarchy. 
  +     * @param next   the next node in the logical RCS hierarchy.
        */
       BranchNode(Version vernum, BranchNode next)
       {
  @@ -116,14 +116,14 @@
       protected void setRCSNext(Node node)
       {
           super.setRCSNext(node);
  -        if (this._child != null)
  +        if (this.getChild() != null)
           {
  -            this._child._parent = null;
  +            this.getChild().parent = null;
           }
  -        this._child = node;
  -        if (this._child != null)
  +        this.child = node;
  +        if (this.getChild() != null)
           {
  -            this._child._parent = this;
  +            this.getChild().parent = this;
           }
       }
   
  @@ -148,13 +148,13 @@
           }
           else if (this.version.isLessThan(branchPoint))
           {
  -            return _child;
  +            return getChild();
           }
           else if (vernum.size() <= this.version.size())
           {
               if (vernum.size() < this.version.size() || branchPoint.last() == 0)
               {
  -                return _child;
  +                return getChild();
               } // keep going
               else
               {
  
  
  
  1.7       +2 -2      
jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Lines.java
  
  Index: Lines.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Lines.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Lines.java        27 Feb 2002 20:18:05 -0000      1.6
  +++ Lines.java        27 Feb 2002 20:58:58 -0000      1.7
  @@ -70,7 +70,7 @@
    * @see Archive
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Juanco Anez</a>
  - * @version $Id: Lines.java,v 1.6 2002/02/27 20:18:05 sbailliez Exp $
  + * @version $Id: Lines.java,v 1.7 2002/02/27 20:58:58 sbailliez Exp $
    */
   class Lines
           extends ArrayList
  @@ -129,7 +129,7 @@
               if (annotate)
               {
                   Node rev = l.getRevision();
  -                o = annotationFormat.format(new Object[]{rev.version, rev._author, 
rev._date});
  +                o = annotationFormat.format(new Object[]{rev.getVersion(), 
rev.getAuthor(), rev.getDate()});
               }
               result[i++] = o;
           }
  
  
  
  1.8       +133 -78   
jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Node.java
  
  Index: Node.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Node.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Node.java 27 Feb 2002 20:17:56 -0000      1.7
  +++ Node.java 27 Feb 2002 20:58:58 -0000      1.8
  @@ -79,16 +79,16 @@
   
   /**
    * Ancestor to all nodes in a version control Archive.
  - * <p>Nodes store the deltas between two revisions of the text.</p> 
  - * 
  + * <p>Nodes store the deltas between two revisions of the text.</p>
  + *
    * This class is NOT thread safe.
    *
    * @see TrunkNode
    * @see BranchNode
    * @see Archive
  - * 
  + *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Juanco Anez</a>
  - * @version $Id: Node.java,v 1.7 2002/02/27 20:17:56 juanco Exp $
  + * @version $Id: Node.java,v 1.8 2002/02/27 20:58:58 sbailliez Exp $
    */
   abstract class Node
           extends ToString
  @@ -98,17 +98,17 @@
       /**
        * The version number for this node.
        */
  -    public final Version version;
  -    protected Date _date = new Date();
  -    protected String _author = System.getProperty("user.name");
  -    protected String _state = "Exp";
  -    protected String _log = "";
  -    protected String _locker = "";
  -    protected Object[] _text;
  -    protected Node _rcsnext;
  -    protected Node _parent;
  -    protected Node _child;
  -    protected TreeMap _branches = null;
  +    protected final Version version;
  +    protected Date date = new Date();
  +    protected String author = System.getProperty("user.name");
  +    protected String state = "Exp";
  +    protected String log = "";
  +    protected String locker = "";
  +    protected Object[] text;
  +    protected Node rcsnext;
  +    protected Node parent;
  +    protected Node child;
  +    protected TreeMap branches = null;
       protected Phrases _phrases = null;
   
       protected static final Format dateFormatter = new MessageFormat(
  @@ -130,11 +130,11 @@
       protected Node(Node other)
       {
           this(other.version, null);
  -        this._date = other._date;
  -        this._author = other._author;
  -        this._state = other._state;
  -        this._log = other._log;
  -        this._locker = other._locker;
  +        this.date = other.date;
  +        this.author = other.author;
  +        this.state = other.state;
  +        this.log = other.log;
  +        this.locker = other.locker;
       }
   
       /**
  @@ -175,7 +175,6 @@
       /**
        * Creates a new node of the adequate type for the given version number.
        * @param vernum The version number for the node.
  -     * @param rcsnext The next node in the RCS logical hierarchy.
        * @return The newly created node.
        */
       static Node newNode(Version vernum)
  @@ -215,11 +214,11 @@
        */
       protected boolean isGhost()
       {
  -        return version.isGhost() || _text == null;
  +        return version.isGhost() || text == null;
       }
   
       /**
  -     * Retrieve the branch node identified with 
  +     * Retrieve the branch node identified with
        * the given numer.
        * @param no The branch number.
        * @return The branch node.
  @@ -227,18 +226,18 @@
        */
       protected BranchNode getBranch(int no)
       {
  -        if (_branches == null)
  +        if (branches == null)
           {
               return null;
           }
           else if (no == 0)
           {
  -            Integer branchNo = (Integer) _branches.lastKey();
  -            return (BranchNode) (branchNo == null ? null : _branches.get(branchNo));
  +            Integer branchNo = (Integer) branches.lastKey();
  +            return (BranchNode) (branchNo == null ? null : branches.get(branchNo));
           }
           else
           {
  -            return (BranchNode) _branches.get(new Integer(no));
  +            return (BranchNode) branches.get(new Integer(no));
           }
       }
   
  @@ -250,9 +249,9 @@
       protected Node root()
       {
           Node result = this;
  -        while (result._parent != null)
  +        while (result.parent != null)
           {
  -            result = result._parent;
  +            result = result.parent;
           }
           return result;
       }
  @@ -263,7 +262,7 @@
        */
       protected void setLocker(String user)
       {
  -        _locker = user.intern();
  +        locker = user.intern();
       }
   
       /**
  @@ -272,13 +271,13 @@
        */
       protected void setAuthor(String user)
       {
  -        _author = user.intern();
  +        author = user.intern();
       }
   
   
       /**
        * Set the date of the node's revision.
  -     * @param value an array of 6 integers, corresponding to the 
  +     * @param value an array of 6 integers, corresponding to the
        * year, month, day, hour, minute, and second of this revision.<br>
        * If the year has two digits, it is interpreted as belonging to the 20th
        * century.<br>
  @@ -286,7 +285,7 @@
        */
       protected void setDate(int[] value)
       {
  -        this._date = new GregorianCalendar(value[0] + (value[0] <= 99 ? 1900 : 0),
  +        this.date = new GregorianCalendar(value[0] + (value[0] <= 99 ? 1900 : 0),
                   value[1] - 1, value[2],
                   value[3], value[4], value[5]).getTime();
       }
  @@ -298,7 +297,7 @@
        */
       protected void setState(String value)
       {
  -        _state = value;
  +        state = value;
       }
   
       /**
  @@ -310,7 +309,7 @@
        */
       protected void setRCSNext(Node node)
       {
  -        _rcsnext = node;
  +        rcsnext = node;
       }
   
       /**
  @@ -320,7 +319,7 @@
        */
       protected void setLog(String value)
       {
  -        _log = value;
  +        log = value;
       }
   
       /**
  @@ -328,7 +327,7 @@
        * <p>For archives containing binary information, the text is an image
        * of the revision contents.</p>
        * <p>For ASCII archives, the text contains the delta between the
  -     * current revision and the next revision in the RCS logical hierarchy. 
  +     * 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.</p>
        * <p> The passed string is converted to an array of objects
        * befored being stored as the revision's text</p>
  @@ -337,7 +336,7 @@
        */
       protected void setText(String value)
       {
  -        this._text = org.apache.maven.jrcs.diff.Diff.stringToArray(value);
  +        this.text = org.apache.maven.jrcs.diff.Diff.stringToArray(value);
       }
   
       /**
  @@ -345,14 +344,14 @@
        * <p>For archives containing binary information, the text is an image
        * of the revision contents.</p>
        * <p>For ASCII archives, the text contains the delta between the
  -     * current revision and the next revision in the RCS logical hierarchy. 
  +     * 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.
        * @param value The revision's text.
        * @see ArchiveParser
        */
       protected void setText(Object[] value)
       {
  -        this._text = Arrays.asList(value).toArray();
  +        this.text = Arrays.asList(value).toArray();
       }
   
       /**
  @@ -364,24 +363,24 @@
       protected void addBranch(BranchNode node)
               throws InvalidVersionNumberException
       {
  -        if (node.version.isLessThan(this.version) 
  +        if (node.version.isLessThan(this.version)
               || node.version.size() != (this.version.size()+2))
           {
               throw new InvalidVersionNumberException("version must be grater");
           }
   
           int branchno = node.version.at(this.version.size());
  -        if (_branches == null)
  +        if (branches == null)
           {
  -            _branches = new TreeMap();
  +            branches = new TreeMap();
           }
  -        _branches.put(new Integer(branchno), node);
  -        node._parent = this;
  +        branches.put(new Integer(branchno), node);
  +        node.parent = this;
       }
   
   
       /**
  -     * Returns the version number that should correspond to 
  +     * Returns the version number that should correspond to
        * the revision folowing this node.
        * @return The next version number.
        */
  @@ -390,7 +389,7 @@
           return this.version.next();
       }
   
  -    
  +
       /**
        * Returns the version number that should correspond to a newly
        * created branch of this node.
  @@ -399,26 +398,26 @@
       protected Version newBranchVersion()
       {
           Version result = new Version(this.version);
  -        if (_branches == null || _branches.size() <= 0)
  +        if (branches == null || branches.size() <= 0)
           {
               result.__addBranch(1);
           }
           else
           {
  -            result.__addBranch(((Integer) _branches.lastKey()).intValue());
  +            result.__addBranch(((Integer) branches.lastKey()).intValue());
           }
           result.__addBranch(1);
           return result;
       }
   
  -    
  +
       /**
        * Return the next node in the RCS logical hierarchy.
        * @return the next node
        */
       protected Node getRCSNext()
       {
  -        return _rcsnext;
  +        return rcsnext;
       }
   
   
  @@ -442,12 +441,12 @@
        * Returns the path from the current node to the node
        * identified by the given version.
        * @param vernum The version number of the last node in the path.
  -     * @param soft If true, no error is thrown if a node with the given 
  +     * @param 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.
        * @return The path
        * @throws NodeNotFoundException if a node with the given version number
  -     * is not reachable following the RCS-next chain from this node. 
  +     * 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 Path
  @@ -472,12 +471,12 @@
        * Returns the next node in the path from the current node to the node
        * identified by the given version.
        * @param vernum The version number of the last node in the path.
  -     * @param soft If true, no error is thrown if a node with the given 
  +     * @param 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.
        * @return The path
        * @throws NodeNotFoundException if a node with the given version number
  -     * is not reachable following the RCS-next chain from this node. 
  +     * 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 Path
  @@ -530,9 +529,9 @@
               org.apache.maven.jrcs.diff.PatchFailedException
       {
           Revision revision = new Revision();
  -        for (int it = 0; it < _text.length; it++)
  +        for (int it = 0; it < text.length; it++)
           {
  -            String cmd = _text[it].toString();
  +            String cmd = text[it].toString();
   
               java.util.StringTokenizer t = new StringTokenizer(cmd, "ad ", true);
               char action;
  @@ -597,34 +596,34 @@
           s.append(version.toString() + EOL);
   
           s.append("_date");
  -        if (_date != null)
  +        if (date != null)
           {
               DateFormat formatter = dateFormat;
               Calendar cal = new GregorianCalendar();
  -            cal.setTime(_date);
  +            cal.setTime(date);
               if (cal.get(Calendar.YEAR) > 1999)
               {
                   formatter = dateFormat2K;
               }
  -            s.append("\t" + formatter.format(_date));
  +            s.append("\t" + formatter.format(date));
           }
           s.append(";\tauthor");
  -        if (_author != null)
  +        if (author != null)
           {
  -            s.append(" " + _author);
  +            s.append(" " + author);
           }
           s.append(";\tstate");
  -        if (_state != null)
  +        if (state != null)
           {
               s.append(" ");
  -            s.append(_state);
  +            s.append(state);
           }
           s.append(EOI);
   
           s.append("branches");
  -        if (_branches != null)
  +        if (branches != null)
           {
  -            for (Iterator i = _branches.values().iterator(); i.hasNext();)
  +            for (Iterator i = branches.values().iterator(); i.hasNext();)
               {
                   Node n = (Node) i.next();
                   if (n != null)
  @@ -636,9 +635,9 @@
           s.append(EOI);
   
           s.append("next\t");
  -        if (_rcsnext != null)
  +        if (rcsnext != null)
           {
  -            s.append(_rcsnext.version.toString());
  +            s.append(rcsnext.version.toString());
           }
           s.append(EOI);
       }
  @@ -668,7 +667,7 @@
           s.append(version.toString() + EOL);
   
           s.append("log" + EOL);
  -        s.append(Archive.quoteString(_log));
  +        s.append(Archive.quoteString(log));
           s.append(EOL);
   
           if (_phrases != null)
  @@ -677,12 +676,12 @@
           }
   
           s.append("text" + EOL);
  -        s.append(Archive.quoteString(Diff.arrayToString(_text) + "\n"));
  +        s.append(Archive.quoteString(Diff.arrayToString(text) + "\n"));
           s.append(EOL);
   
  -        if (_branches != null)
  +        if (branches != null)
           {
  -            for (Iterator i = _branches.values().iterator(); i.hasNext();)
  +            for (Iterator i = branches.values().iterator(); i.hasNext();)
               {
                   Node n = (Node) i.next();
                   if (n != null)
  @@ -693,7 +692,7 @@
           }
       }
   
  -    /** 
  +    /**
        * Return a list with the lines of the node's text.
        * @return The list
        */
  @@ -702,7 +701,7 @@
           return getTextLines(new LinkedList());
       }
   
  -    /** 
  +    /**
        * Return a list with a subset of the lines of the node's text.
        * @param from The offset of the first line to retrieve.
        * @param to The offset of the line after the last one to retrieve.
  @@ -713,16 +712,16 @@
           return getTextLines(new LinkedList(), from, to);
       }
   
  -    /** 
  +    /**
        * Add a subset of the lines of the node's text to the given list.
        * @return The given list after the additions have been made.
        */
      protected List getTextLines(List lines)
       {
  -        return getTextLines(lines, 0, _text.length);
  +        return getTextLines(lines, 0, text.length);
       }
   
  -    /** 
  +    /**
        * Add a subset of the lines of the node's text to the given list.
        * @param from The offset of the first line to retrieve.
        * @param to The offset of the line after the last one to retrieve.
  @@ -732,9 +731,65 @@
       {
           for (int i = from; i < to; i++)
           {
  -            lines.add(new Line(deltaRevision(), _text[i]));
  +            lines.add(new Line(deltaRevision(), text[i]));
           }
           return lines;
       }
  +
  +    protected final Date getDate()
  +    {
  +        return date;
  +    }
  +
  +    protected final String getAuthor()
  +    {
  +        return author;
  +    }
  +
  +    protected final String getState()
  +    {
  +        return state;
  +    }
  +
  +    protected final String getLog()
  +    {
  +        return log;
  +    }
  +
  +    protected final String getLocker()
  +    {
  +        return locker;
  +    }
  +
  +    protected final Object[] getText()
  +    {
  +        return text;
  +    }
  +
  +    protected final Node getChild()
  +    {
  +        return child;
  +    }
  +
  +    protected final TreeMap getBranches()
  +    {
  +        return branches;
  +    }
  +
  +    protected final Node getParent()
  +    {
  +        return parent;
  +    }
  +
  +    protected final Version getVersion()
  +    {
  +        return version;
  +    }
  +
  +    protected Phrases getPhrases()
  +    {
  +        return _phrases;
  +    }
  +
   }
   
  
  
  
  1.9       +17 -17    
jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/TrunkNode.java
  
  Index: TrunkNode.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/TrunkNode.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TrunkNode.java    27 Feb 2002 20:48:43 -0000      1.8
  +++ TrunkNode.java    27 Feb 2002 20:58:58 -0000      1.9
  @@ -60,21 +60,21 @@
   /**
    * Represents a node on the trunk or main branch of a version control Archive.
    *
  - * <p>A {@linkplain TrunkNode TrunkNode} stores the deltas between the node's 
  - * revision and the previous revision; 
  + * <p>A {@linkplain TrunkNode 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. 
  + * text of the previous revision is obtained.
    * The {@linkplain Node._rcsnext rcsnext} field of a TrunkNode
    * points to the node corresponding to the previous revision.</p>
    * This class is NOT thread safe.
    *
    * @see Node
    * @see Archive
  - * 
  + *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Juanco Anez</a>
  - * @version $Id: TrunkNode.java,v 1.8 2002/02/27 20:48:43 juanco Exp $
  + * @version $Id: TrunkNode.java,v 1.9 2002/02/27 20:58:58 sbailliez Exp $
    */
  -class TrunkNode 
  +class TrunkNode
           extends Node
   {
   
  @@ -109,21 +109,21 @@
       protected void setRCSNext(Node node)
       {
           super.setRCSNext(node);
  -        if (this._parent != null)
  +        if (this.getParent() != null)
           {
  -            this._parent._child = null;
  +            this.getParent().child = null;
           }
  -        this._parent = node;
  -        if (this._parent != null)
  +        this.parent = node;
  +        if (this.getParent() != null)
           {
  -            this._parent._child = this;
  +            this.getParent().child = this;
           }
       }
   
   
       protected Node deltaRevision()
       {
  -        return (_child != null ? _child : this);
  +        return (getChild() != null ? getChild() : this);
       }
   
       protected Node nextInPathTo(Version vernum, boolean soft)
  @@ -145,7 +145,7 @@
           Version thisBase = this.version.getBase(branchPoint.size());
           if (thisBase.isGreaterThan(branchPoint))
           {
  -            return _parent;
  +            return getParent();
           }
           else if (vernum.size() > this.version.size())
           {
  @@ -177,13 +177,13 @@
               org.apache.maven.jrcs.diff.PatchFailedException
       {
           Node root = this.root();
  -        for (int it = 0; it < _text.length; it++)
  +        for (int it = 0; it < getText().length; it++)
           {
  -            original.add(new Line(root, _text[it]));
  +            original.add(new Line(root, getText()[it]));
           }
  -        if (annotate && _parent != null)
  +        if (annotate && getParent() != null)
           {
  -            _parent.pathTo(root.version).patch(original, true);
  +            getParent().pathTo(root.version).patch(original, true);
           }
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to