You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ju...@apache.org on 2002/12/21 17:49:26 UTC

cvs commit: jakarta-commons-sandbox/jrcs/src/java/org/apache/commons/jrcs/rcs Archive.java Node.java

juanco      2002/12/21 08:49:26

  Modified:    jrcs/src/java/org/apache/commons/jrcs/rcs Archive.java
                        Node.java
  Log:
  Made methods in Node public so they can be used in and while traversing the
  archive tree.
  
  Added methods to retreive the description and the list of symbols of an
  archive.
  Submitted by:	Mathew Sozeau <ma...@netcourrier.com>
  
  Revision  Changes    Path
  1.5       +21 -2     jakarta-commons-sandbox/jrcs/src/java/org/apache/commons/jrcs/rcs/Archive.java
  
  Index: Archive.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jrcs/src/java/org/apache/commons/jrcs/rcs/Archive.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Archive.java	8 Nov 2002 21:29:34 -0000	1.4
  +++ Archive.java	21 Dec 2002 16:49:26 -0000	1.5
  @@ -364,6 +364,15 @@
           symbols.put(sym, vernum);
       }
   
  +    /**
  +     * Returns a Map of the symbols (tags) associated with each revision.
  +     * The symbols are the keys and the revision numbers are the values.
  +     * @return A map of symbol/revision number pairs.
  +    public Map getSymbols()
  +    {
  +        return symbols;
  +    }
  +
   
       /**
        * Add a lock over a revison.
  @@ -1194,11 +1203,21 @@
   
           return (Node[]) result.toArray(new Node[result.size()]);
       }
  +
  +    
  +    /**
  +     * Returns the description associated with the archive.
  +     * @return the description
  +     */
  +    public String getDesc()
  +    {
  +        return desc;
  +    }
       
       
       /** Returns the log message associated with the given revision.
        *  @param version - the version to get the log message for
  -     * 	@return the log message for the version.
  +     *  @return the log message for the version.
        *  @exception - if the version does not exist for the archive.
        */
       public String getLog(Version version) 
  
  
  
  1.3       +39 -39    jakarta-commons-sandbox/jrcs/src/java/org/apache/commons/jrcs/rcs/Node.java
  
  Index: Node.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jrcs/src/java/org/apache/commons/jrcs/rcs/Node.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Node.java	28 Sep 2002 15:57:11 -0000	1.2
  +++ Node.java	21 Dec 2002 16:49:26 -0000	1.3
  @@ -212,7 +212,7 @@
        * Ghost nodes have no associated text ot deltas. CVS uses
        * them to mark certain points in the node hierarchy.
        */
  -    protected boolean isGhost()
  +    public boolean isGhost()
       {
           return version.isGhost() || text == null;
       }
  @@ -224,7 +224,7 @@
        * @return The branch node.
        * @see BranchNode
        */
  -    protected BranchNode getBranch(int no)
  +    public BranchNode getBranch(int no)
       {
           if (branches == null)
           {
  @@ -246,7 +246,7 @@
        * Return the root node of the node hierarchy.
        * @return The root node.
        */
  -    protected Node root()
  +    public Node root()
       {
           Node result = this;
           while (result.parent != null)
  @@ -260,7 +260,7 @@
        * Set the locker.
        * @param user A symbol that identifies the locker.
        */
  -    protected void setLocker(String user)
  +    public void setLocker(String user)
       {
           locker = user.intern();
       }
  @@ -269,7 +269,7 @@
        * Set the author of the node's revision.
        * @param user A symbol that identifies the author.
        */
  -    protected void setAuthor(String user)
  +    public void setAuthor(String user)
       {
           author = user.intern();
       }
  @@ -283,7 +283,7 @@
        * century.<br>
        * The month is a number from 1 to 12.
        */
  -    protected void setDate(int[] value)
  +    public void setDate(int[] value)
       {
           this.date = new GregorianCalendar(value[0] + (value[0] <= 99 ? 1900 : 0),
                   value[1] - 1, value[2],
  @@ -295,7 +295,7 @@
        * @param value A symbol that identifies the state. The most commonly
        * used value is Exp.
        */
  -    protected void setState(String value)
  +    public void setState(String value)
       {
           state = value;
       }
  @@ -307,7 +307,7 @@
        * points to the next revision.
        * @param node The next node in the RCS logical hierarchy.
        */
  -    protected void setRCSNext(Node node)
  +    public void setRCSNext(Node node)
       {
           rcsnext = node;
       }
  @@ -317,7 +317,7 @@
        * The log message is usually used to explain why the revision took place.
        * @param value The message.
        */
  -    protected void setLog(String value)
  +    public void setLog(String value)
       {
         // the last newline belongs to the file format
         if(value.endsWith(Archive.RCS_NEWLINE))
  @@ -338,7 +338,7 @@
        * @param value The revision's text.
        * @see ArchiveParser
        */
  -    protected void setText(String value)
  +    public void setText(String value)
       {
           this.text = org.apache.commons.jrcs.diff.Diff.stringToArray(value);
       }
  @@ -353,7 +353,7 @@
        * @param value The revision's text.
        * @see ArchiveParser
        */
  -    protected void setText(Object[] value)
  +    public void setText(Object[] value)
       {
           this.text = Arrays.asList(value).toArray();
       }
  @@ -364,7 +364,7 @@
        * @throws InvalidVersionNumberException if the version number
        * is not a valid branch version number for the current node
        */
  -    protected void addBranch(BranchNode node)
  +    public void addBranch(BranchNode node)
               throws InvalidVersionNumberException
       {
           if (node.version.isLessThan(this.version)
  @@ -388,7 +388,7 @@
        * the revision folowing this node.
        * @return The next version number.
        */
  -    protected Version nextVersion()
  +    public Version nextVersion()
       {
           return this.version.next();
       }
  @@ -399,7 +399,7 @@
        * created branch of this node.
        * @return the new branch's version number.
        */
  -    protected Version newBranchVersion()
  +    public Version newBranchVersion()
       {
           Version result = new Version(this.version);
           if (branches == null || branches.size() <= 0)
  @@ -419,7 +419,7 @@
        * Return the next node in the RCS logical hierarchy.
        * @return the next node
        */
  -    protected Node getRCSNext()
  +    public Node getRCSNext()
       {
           return rcsnext;
       }
  @@ -435,7 +435,7 @@
        * from this node.
        * @see Path
        */
  -    protected Path pathTo(Version vernum)
  +    public Path pathTo(Version vernum)
               throws NodeNotFoundException
       {
           return pathTo(vernum, false);
  @@ -455,7 +455,7 @@
        * version number doesn't exist.
        * @see Path
        */
  -    protected Path pathTo(Version vernum, boolean soft)
  +    public Path pathTo(Version vernum, boolean soft)
               throws NodeNotFoundException
       {
           Path path = new Path();
  @@ -485,7 +485,7 @@
        * version number doesn't exist.
        * @see Path
        */
  -    protected abstract Node nextInPathTo(Version vernum, boolean soft)
  +    public abstract Node nextInPathTo(Version vernum, boolean soft)
               throws NodeNotFoundException;
   
   
  @@ -501,7 +501,7 @@
        * corresponds to the next revision in the chain.</p>
        * @return The node for the delta revision.
        */
  -    protected abstract Node deltaRevision();
  +    public abstract Node deltaRevision();
   
   
       /**
  @@ -511,7 +511,7 @@
        * @throws PatchFailedException if the diff engine determines that
        * the deltas cannot apply to the given text.
        */
  -    protected void patch(List original)
  +    public void patch(List original)
               throws InvalidFileFormatException,
               PatchFailedException
       {
  @@ -528,7 +528,7 @@
        * @throws PatchFailedException if the diff engine determines that
        * the deltas cannot apply to the given text.
        */
  -    protected void patch(List original, boolean annotate)
  +    public void patch(List original, boolean annotate)
               throws InvalidFileFormatException,
               org.apache.commons.jrcs.diff.PatchFailedException
       {
  @@ -651,7 +651,7 @@
        * Conver the urrent node to its RCS string representation.
        * @return The string representation
        */
  -    protected String toText()
  +    public String toText()
       {
           final StringBuffer s = new StringBuffer();
           toText(s, Archive.RCS_NEWLINE);
  @@ -665,7 +665,7 @@
        * @param s The string buffer to add the node's image to.
        * @param EOL The line separator to use.
        */
  -    protected void toText(StringBuffer s, String EOL)
  +    public void toText(StringBuffer s, String EOL)
       {
           s.append(EOL + EOL);
           s.append(version.toString() + EOL);
  @@ -703,7 +703,7 @@
        * Return a list with the lines of the node's text.
        * @return The list
        */
  -    protected List getTextLines()
  +    public List getTextLines()
       {
           return getTextLines(new LinkedList());
       }
  @@ -714,7 +714,7 @@
        * @param to The offset of the line after the last one to retrieve.
        * @return The list
        */
  -    protected List getTextLines(int from, int to)
  +    public List getTextLines(int from, int to)
       {
           return getTextLines(new LinkedList(), from, to);
       }
  @@ -723,7 +723,7 @@
        * 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)
  +   public List getTextLines(List lines)
       {
           return getTextLines(lines, 0, text.length);
       }
  @@ -734,7 +734,7 @@
        * @param to The offset of the line after the last one to retrieve.
        * @return The given list after the additions have been made.
        */
  -    protected List getTextLines(List lines, int from, int to)
  +    public List getTextLines(List lines, int from, int to)
       {
           for (int i = from; i < to; i++)
           {
  @@ -743,57 +743,57 @@
           return lines;
       }
   
  -    protected final Date getDate()
  +    public final Date getDate()
       {
           return date;
       }
   
  -    protected final String getAuthor()
  +    public final String getAuthor()
       {
           return author;
       }
   
  -    protected final String getState()
  +    public final String getState()
       {
           return state;
       }
   
  -    protected final String getLog()
  +    public final String getLog()
       {
           return log;
       }
   
  -    protected final String getLocker()
  +    public final String getLocker()
       {
           return locker;
       }
   
  -    protected final Object[] getText()
  +    public final Object[] getText()
       {
           return text;
       }
   
  -    protected final Node getChild()
  +    public final Node getChild()
       {
           return child;
       }
   
  -    protected final TreeMap getBranches()
  +    public final TreeMap getBranches()
       {
           return branches;
       }
   
  -    protected final Node getParent()
  +    public final Node getParent()
       {
           return parent;
       }
   
  -    protected final Version getVersion()
  +    public final Version getVersion()
       {
           return version;
       }
   
  -    protected Phrases getPhrases()
  +    public Phrases getPhrases()
       {
           return phrases;
       }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>