commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwaldh...@apache.org
Subject cvs commit: jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example Quicksort.java
Date Tue, 04 Mar 2003 17:59:30 GMT
rwaldhoff    2003/03/04 09:59:29

  Modified:    functor/src/test/org/apache/commons/functor/example
                        Quicksort.java
  Log:
  minor documentation tweaks
  
  Revision  Changes    Path
  1.6       +13 -11    jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/Quicksort.java
  
  Index: Quicksort.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/functor/src/test/org/apache/commons/functor/example/Quicksort.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Quicksort.java	4 Mar 2003 17:28:22 -0000	1.5
  +++ Quicksort.java	4 Mar 2003 17:59:29 -0000	1.6
  @@ -84,12 +84,12 @@
    */
   
   /* 
  + * Here's an example of the Quicksort sorting algorithm, implemented using
  + * commons-functor.
  + * 
    * We'll write this quicksort implementation in a literate programming style,
    * (in other words, with descriptive prose mixed right in with the source).
    * 
  - * Within this source file, the "literate" comments will use
  - * c-style, multi-line comments (slash-star to star-slash).
  - * 
    * For convenience, and to make sure this example stays up to date, 
    * we'll implement our quicksort example as a JUnit TestCase.
    */
  @@ -161,7 +161,7 @@
       }    
   
   /*
  - * Similarly, sorting an List composed of a single element
  + * Similarly, sorting a List composed of a single element
    * should produce an equivalent list:
    */
   
  @@ -184,7 +184,7 @@
       }    
   
   /*
  - * Finally, sorting an List composed of multiple copies
  + * Finally, sorting a List composed of multiple copies
    * of a single value should produce an equivalent list:
    */
   
  @@ -212,6 +212,9 @@
    */
       public void testSortSorted() {
           List list = new ArrayList();
  +        for(int i=0;i<10;i++) {
  +            list.add(new Integer(i));
  +        }
           
           List sorted = quicksort(list);
           
  @@ -288,7 +291,7 @@
   /*
    * Finally, while this quicksort implementation is intended to 
    * illustrate the use of Commons Functor, not for performance,
  - * let's output some timings, just to demonstrate that the 
  + * let's output some timings just to demonstrate that the 
    * performance is adequate.
    */
    
  @@ -393,8 +396,7 @@
    * THE QUICKSORT ALGORITHM:
    * ----------------------------------------------------------------------------
    * 
  - * As you may recall, the quicksort sorting algorithm can be summarized as 
  - * follows:
  + * The quicksort sorting algorithm can be summarized as follows:
    * 
    * Given a list of elements to be sorted:
    * 
  @@ -468,7 +470,7 @@
       private UnaryFunction quicksort = new ConditionalUnaryFunction(        
           IsEmpty.getIsEmpty(),                         /* If the list is empty, */
           new ConstantFunction(Collections.EMPTY_LIST), /*  then return an empty list, */
  -        new ListFunction() {                          /*  else, split and recurse*/
  +        new ListFunction() {                          /*  else, split and recurse */
               public Object evaluate(List list) {
                   List result = new ArrayList(list.size());
                   Object h = head.evaluate(list);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message