You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ju...@apache.org on 2002/02/27 21:48:43 UTC

cvs commit: jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs BranchNode.java Path.java TrunkNode.java Version.java

juanco      02/02/27 12:48:43

  Modified:    src/java/org/apache/maven/jrcs/rcs BranchNode.java Path.java
                        TrunkNode.java Version.java
  Log:
  added more of the missing javadoc comments
  
  Revision  Changes    Path
  1.8       +5 -3      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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BranchNode.java	27 Feb 2002 20:17:56 -0000	1.7
  +++ BranchNode.java	27 Feb 2002 20:48:43 -0000	1.8
  @@ -70,7 +70,7 @@
    * @see Archive
    * 
    * @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
  - * @version $Id: BranchNode.java,v 1.7 2002/02/27 20:17:56 juanco Exp $
  + * @version $Id: BranchNode.java,v 1.8 2002/02/27 20:48:43 juanco Exp $
    */
   class BranchNode 
           extends Node
  @@ -108,8 +108,10 @@
   
   
       /**
  -     * Set the next node in the RCS logical hierarcy. Update the parent
  -     * and _child node accordingly.
  +     * 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.
        */
       protected void setRCSNext(Node node)
       {
  
  
  
  1.7       +58 -1     jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Path.java
  
  Index: Path.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Path.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Path.java	27 Feb 2002 20:18:05 -0000	1.6
  +++ Path.java	27 Feb 2002 20:48:43 -0000	1.7
  @@ -72,26 +72,42 @@
    * @see Node
    *
    * @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
  - * @version $Id: Path.java,v 1.6 2002/02/27 20:18:05 sbailliez Exp $
  + * @version $Id: Path.java,v 1.7 2002/02/27 20:48:43 juanco Exp $
    */
   class Path
   {
       private List path = new LinkedList();
   
  +    /**
  +     * Creates an empty Path
  +     */
       public Path()
       {
       }
   
  +    /**
  +     * Add a node to the Path.
  +     * @param node The Node to add.
  +     */
       public void add(Node node)
       {
           path.add(node);
       }
   
  +
  +    /**
  +     * The size of the Path.
  +     * @return The size of the Path
  +     */
       public int size()
       {
           return path.size();
       }
   
  +    /**
  +     * Return the last node in the path or null if the path is empty.
  +     * @return the last node in the path or null if the path is empty.
  +     */
       public Node last()
       {
           if (size() == 0)
  @@ -104,6 +120,14 @@
           }
       }
   
  +    
  +    /**
  +     * Returns the text that corresponds to applying the patches
  +     * in the list of nodes in the Path.
  +     * Assume that the text of the first node is plaintext and not
  +     * deltatext.
  +     * @return The resulting text after the patches
  +     */
       public List patch()
               throws InvalidFileFormatException,
               PatchFailedException,
  @@ -112,6 +136,16 @@
           return patch(false);
       }
   
  +    /**
  +     * Returns the text that corresponds to applying the patches
  +     * in the list of nodes in the Path.
  +     * Assume that the text of the first node is plaintext and not
  +     * deltatext.
  +     * @param annotate if true, then each text line is a 
  +     * {@linkplain Line Line} with the original text annotated with
  +     * the revision in which it was last changed or added.
  +     * @return The resulting text after the patches
  +     */
       public List patch(boolean annotate)
               throws InvalidFileFormatException,
               PatchFailedException,
  @@ -120,6 +154,17 @@
           return patch(new Lines(), annotate);
       }
   
  +    /**
  +     * Returns the text that corresponds to applying the patches
  +     * in the list of nodes in the Path.
  +     * Assume that the text of the first node is plaintext and not
  +     * deltatext.
  +     * @param lines The list to where the text must be added and the 
  +     * patches applied.
  +     * {@linkplain Line Line} with the original text annotated with
  +     * the revision in which it was last changed or added.
  +     * @return The resulting text after the patches
  +     */
       public List patch(List lines)
               throws InvalidFileFormatException,
               PatchFailedException,
  @@ -128,6 +173,18 @@
           return patch(lines, false);
       }
   
  +    /**
  +     * Returns the text that corresponds to applying the patches
  +     * in the list of nodes in the Path.
  +     * Assume that the text of the first node is plaintext and not
  +     * deltatext.
  +     * @param lines The list to where the text must be added and the 
  +     * patches applied.
  +     * @param annotate if true, then each text line is a 
  +     * {@linkplain Line Line} with the original text annotated with
  +     * the revision in which it was last changed or added.
  +     * @return The resulting text after the patches
  +     */
       public List patch(List lines, boolean annotate)
               throws InvalidFileFormatException,
               PatchFailedException,
  
  
  
  1.8       +12 -3     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TrunkNode.java	27 Feb 2002 20:17:56 -0000	1.7
  +++ TrunkNode.java	27 Feb 2002 20:48:43 -0000	1.8
  @@ -72,20 +72,24 @@
    * @see Archive
    * 
    * @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
  - * @version $Id: TrunkNode.java,v 1.7 2002/02/27 20:17:56 juanco Exp $
  + * @version $Id: TrunkNode.java,v 1.8 2002/02/27 20:48:43 juanco Exp $
    */
   class TrunkNode 
           extends Node
   {
   
  +    /**
  +     * Create a TrunkNode bu copying another TrunkNode.
  +     */
       TrunkNode(TrunkNode other)
       {
           super(other);
       }
   
       /**
  -     * the next field in a Trunk node points to the immediate
  -     * previos revision
  +     * Create a TrunkNode.
  +     * The next field in a TrunkNode points to the immediate
  +     * previos revision or parent.
        */
       TrunkNode(Version vernum, TrunkNode next)
               throws InvalidTrunkVersionNumberException
  @@ -97,6 +101,11 @@
           }
       }
   
  +    /**
  +     * 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.
  +     */
       protected void setRCSNext(Node node)
       {
           super.setRCSNext(node);
  
  
  
  1.7       +100 -2    jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Version.java
  
  Index: Version.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/rcs/Version.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Version.java	27 Feb 2002 20:18:05 -0000	1.6
  +++ Version.java	27 Feb 2002 20:48:43 -0000	1.7
  @@ -67,7 +67,7 @@
    * @see Archive
    *
    * @author <a href="mailto:juanco@suigeneris.org">Juanco Anez</a>
  - * @version $Id: Version.java,v 1.6 2002/02/27 20:18:05 sbailliez Exp $
  + * @version $Id: Version.java,v 1.7 2002/02/27 20:48:43 juanco Exp $
    */
   public class Version
           extends ToString
  @@ -75,16 +75,30 @@
   {
       private int[] numbers = new int[0];
   
  + 
  +    /**
  +     * Creates a new Version with a single digit version number
  +     * @param major the version number
  +     */
       public Version(int major)
       {
           numbers = new int[]{major};
       }
   
  +    /**
  +     * Creates a new Version with a major.minor version number.
  +     * @param major the major version number
  +     * @param major the minor version number
  +     */
       public Version(int major, int minor)
       {
           numbers = new int[]{major, minor};
       }
   
  +    /**
  +     * Converts an array of Integer to a Version.
  +     * @param num an array of Integers
  +     */
       public Version(Integer[] num)
       {
           numbers = new int[num.length];
  @@ -94,12 +108,25 @@
           }
       }
   
  +    /**
  +     * Converts an array of int to a Version.
  +     * @param num an array of int
  +     */
       public Version(int[] num)
       {
           numbers = (int[]) num.clone();
       }
   
  -    public Version(String v) throws InvalidVersionNumberException
  +    /**
  +     * Converts string to a version.
  +     * @param v a string accepted by the following regular expression.
  +     * <code>
  +     *   [0-9]+(.[0-9]+)*
  +     * </code>
  +     * @throws InvalidVersionNumberException if the string cannot be parsed
  +     */
  +    public Version(String v) 
  +            throws InvalidVersionNumberException
       {
           if (v.endsWith("."))
           {
  @@ -127,6 +154,10 @@
           }
       }
   
  +    /**
  +     * Create a new Version by copying another.
  +     * @param v the version to copy
  +     */
       public Version(Version v)
       {
           this.numbers = (int[]) v.numbers.clone();
  @@ -136,6 +167,9 @@
           }
       }
   
  +    /**
  +     * Create an empty version number.
  +     */
       public Version()
       {
       }
  @@ -145,11 +179,24 @@
           return new Version(this);
       }
   
  +
  +    /**
  +     * Return the current version number as an array of int.
  +     * @return the current version number as an array of int.
  +     */
       public int[] getNumbers()
       {
           return (int[]) this.numbers.clone();
       }
   
  +
  +    /**
  +     * Compares two versions.
  +     * The comparison is done the usual way, i.e.,  2.0 is greter than 1.99.1,
  +     * and 0.1.2 is greater than 0.1
  +     * @param ver the version to compare to.
  +     * @return 0 if this == ver, 1 if this greater than ver, -1 otherwise.
  +     */
       public int compareVersions(Version ver)
       {
           int[] nthis = this.numbers;
  @@ -178,6 +225,15 @@
           }
       }
   
  +    /**
  +     * Compares two versions in lexigographical order.
  +     * Unlike compareVersions, this comparison is not done in 
  +     * the way usual for versions numbers. The order relationship
  +     * stablished here is the one CVS used to store nodes into archive
  +     * files.
  +     * @param other The version to compare to
  +     * @see #compareVersions
  +     */
       public int compareTo(Object other)
       {
           if (other == this)
  @@ -206,26 +262,55 @@
           }
       }
   
  +    /**
  +     * Determine if this version is greater than the given one.
  +     * @param ver the version to compare to.
  +     * @return true if compareVersions(ver) &gt; 0
  +     * @see #compareVersions
  +     */
       public boolean isGreaterThan(Version ver)
       {
           return compareVersions(ver) > 0;
       }
   
  +    /**
  +     * Determine if this version is greater than or equal to the given one.
  +     * @param ver the version to compare to.
  +     * @return true if compareVersions(ver) &gt;= 0
  +     * @see #compareVersions
  +     */
       public boolean isGreaterOrEqualThan(Version ver)
       {
           return compareVersions(ver) >= 0;
       }
   
  +    /**
  +     * Determine if this version is less than the given one.
  +     * @param ver the version to compare to.
  +     * @return true if compareVersions(ver) &lt; 0
  +     * @see #compareVersions
  +     */
       public boolean isLessThan(Version ver)
       {
           return compareVersions(ver) < 0;
       }
   
  +    /**
  +     * Determine if this version is less than or equal to the given one.
  +     * @param ver the version to compare to.
  +     * @return true if compareVersions(ver) &lt;= 0
  +     * @see #compareVersions
  +     */
       public boolean isLessOrEqualThan(Version ver)
       {
           return compareVersions(ver) <= 0;
       }
   
  +    /**
  +     * Determine if two versions are equal.
  +     * @param o the version to compare to
  +     * @return true if both versions represent the same version number
  +     */
       public boolean equals(Object o)
       {
           if (this == o)
  @@ -251,16 +336,29 @@
           return toString().hashCode();
       }
   
  +    /**
  +     * Return the version number at the given position.
  +     * @param pos the position.
  +     * @return the number.
  +     */
       public int at(int pos)
       {
           return numbers[pos];
       }
   
  +    /**
  +     * Return the last number in the version number.
  +     * @return the number.
  +     */
       public int last()
       {
           return at(size() - 1);
       }
   
  +    /**
  +     * Return the last number in the version number.
  +     * @return the number.
  +     */
       public Version getBase(int positions)
       {
           positions = (positions > numbers.length ? numbers.length : positions);
  
  
  

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