lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ehatc...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/search Sort.java SortField.java
Date Sun, 04 Apr 2004 15:28:14 GMT
ehatcher    2004/04/04 08:28:14

  Modified:    src/java/org/apache/lucene/search Sort.java SortField.java
  Log:
  handy toString methods for the new Sort classes.  feel free to adjust the aesthetics
  
  Revision  Changes    Path
  1.6       +13 -1     jakarta-lucene/src/java/org/apache/lucene/search/Sort.java
  
  Index: Sort.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/Sort.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Sort.java	25 Mar 2004 18:47:15 -0000	1.5
  +++ Sort.java	4 Apr 2004 15:28:14 -0000	1.6
  @@ -202,4 +202,16 @@
   	public void setSort (SortField[] fields) {
   		this.fields = fields;
   	}
  +
  +  public String toString() {
  +    StringBuffer buffer = new StringBuffer();
  +
  +    for (int i = 0; i < fields.length; i++) {
  +      buffer.append(fields[i].toString());
  +      if ((i +1) < fields.length)
  +        buffer.append(',');
  +    }
  +
  +    return buffer.toString();
  +  }
   }
  
  
  
  1.4       +19 -1     jakarta-lucene/src/java/org/apache/lucene/search/SortField.java
  
  Index: SortField.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/SortField.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SortField.java	2 Mar 2004 14:54:55 -0000	1.3
  +++ SortField.java	4 Apr 2004 15:28:14 -0000	1.4
  @@ -133,4 +133,22 @@
     public boolean getReverse() {
       return reverse;
     }
  +
  +  public String toString() {
  +    StringBuffer buffer = new StringBuffer();
  +    switch (type) {
  +      case SCORE: buffer.append("<score>");
  +                  break;
  +
  +      case DOC: buffer.append("<doc>");
  +                break;
  +
  +      default: buffer.append("\"" + field + "\"");
  +               break;
  +    }
  +    
  +    buffer.append(reverse ? " DESC" : " ASC");
  +
  +    return buffer.toString();
  +  }
   }
  
  
  

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


Mime
View raw message