wam         2002/07/29 05:17:26

  Modified:    src/share/org/apache/slide/search/basic OrderBy.java
  Log:
  bugfix
  
  Revision  Changes    Path
  1.7       +21 -5     
jakarta-slide/src/share/org/apache/slide/search/basic/OrderBy.java
  
  Index: OrderBy.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/OrderBy.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- OrderBy.java      19 Jun 2002 11:00:11 -0000      1.6
  +++ OrderBy.java      29 Jul 2002 12:17:26 -0000      1.7
  @@ -211,7 +211,14 @@
       class _Comparator implements Comparator  {
           
           /**
  -         * Method compare
  +         * Compares two ComparableResources. Two resources are equal, if they
  +         * have the same URI. Each <order> element within <orderby> generates
  +         * a CompareHint object containing the property to compare and ascending
  +         * / descending. If the two resources are not equal, they are compared
  +         * according the first CompareHint. If this one returns "equal" (0),
  +         * they are compared according the next CompareHint and so on. If the
  +         * two resources are equal according all CompareHints, the first one is
  +         * considered to be greater than the second.
            *
            * @param    o1                  an Object
            * @param    o2                  an Object
  @@ -224,12 +231,21 @@
               ComparableResource r2 = (ComparableResource)o2;
           
               int result = 0;
  +            if (r1.getInternalHref().equals (r2.getInternalHref())) {
  +                result = 0;
  +            }
  +            else {
               
               Iterator it = orderByElements.iterator();
               while (it.hasNext() && result == 0) {
                   CompareHint obe = (CompareHint)it.next();
                   result = r1.compareTo (r2, obe);
               }
  +                
  +                if (result == 0)
  +                    result = 1;
  +            }
  +            
               return result;
           }
       }
  
  
  

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

Reply via email to