/[classpath]/classpath/java/text/CollationKey.java
ViewVC logotype

Diff of /classpath/java/text/CollationKey.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by mkoch, Wed Apr 30 12:34:37 2003 UTC revision 1.5 by mkoch, Fri May 2 08:17:38 2003 UTC
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package java.text;  package java.text;
40    
41    /* Written using "Java Class Libraries", 2nd edition, plus online
42     * API docs for JDK 1.2 from http://www.javasoft.com.
43     * Status: Believed complete and correct.
44     */
45    
46  /**  /**
47   * This class represents a pre-computed series of bits representing a   * This class represents a pre-computed series of bits representing a
48   * <code>String</code> for under a particular <code>Collator</code>.  This   * <code>String</code> for under a particular <code>Collator</code>.  This
# Line 55  package java.text; Line 60  package java.text;
60   * <code>getCollationKey</code> method on an instance of <code>Collator</code>.   * <code>getCollationKey</code> method on an instance of <code>Collator</code>.
61   *   *
62   * @author Aaron M. Renn <arenn@urbanophile.com>   * @author Aaron M. Renn <arenn@urbanophile.com>
63     * @author Tom Tromey <tromey@cygnus.com>
64     * @date March 25, 1999
65   */   */
66  public final class CollationKey implements Comparable  public final class CollationKey implements Comparable
67  {  {
# Line 73  public final class CollationKey implemen Line 80  public final class CollationKey implemen
80     */     */
81    private byte[] key;    private byte[] key;
82    
83    CollationKey(Collator collator, String str, byte[] key)    CollationKey (Collator collator, String str, byte[] key)
84    {    {
85      this.collator = collator;      this.collator = collator;
86      this.str = str;      this.str = str;
# Line 81  public final class CollationKey implemen Line 88  public final class CollationKey implemen
88    }    }
89    
90    /**    /**
    * This method returns the <code>String</code> that this object was created  
    * from.  
    *  
    * @return The source <code>String</code> for this object.  
    */  
   public String getSourceString()  
   {  
     return(str);  
   }  
   
   /**  
    * This method returns the collation bit sequence as a byte array.  
    *  
    * @param A byte array containing the collation bit sequence.  
    */  
   public byte[] toByteArray()  
   {  
     return(key);  
   }  
   
   /**  
    * This method compares the specified object to this one.  The specified  
    * object must be an instance of <code>CollationKey</code> or an exception  
    * will be thrown.  An integer is returned which indicates whether the  
    * specified object is less than, greater than, or equal to this object.  
    *  
    * @param obj The <code>Object</code> to compare against this one.  
    *  
    * @return A negative integer if this object is less than the specified object, 0 if it is equal or a positive integer if it is greater than the specified object.  
    */  
   public int compareTo(Object obj)  
   {  
     return(compareTo((CollationKey)obj));  
   }  
   
   /**  
91     * This method compares the specified object to this one.  An integer is     * This method compares the specified object to this one.  An integer is
92     * returned which indicates whether the specified object is less than,     * returned which indicates whether the specified object is less than,
93     * greater than, or equal to this object.     * greater than, or equal to this object.
# Line 125  public final class CollationKey implemen Line 96  public final class CollationKey implemen
96     *     *
97     * @return A negative integer if this object is less than the specified object, 0 if it is equal or a positive integer if it is greater than the specified object.     * @return A negative integer if this object is less than the specified object, 0 if it is equal or a positive integer if it is greater than the specified object.
98     */     */
99    public int compareTo(CollationKey ck)    public int compareTo (CollationKey ck)
100    {    {
101      int i;      int i;
102      for (i = 0; i < key.length; i++)      for (i = 0; i < key.length; i++)
# Line 147  public final class CollationKey implemen Line 118  public final class CollationKey implemen
118    }    }
119    
120    /**    /**
121       * This method compares the specified object to this one.  The specified
122       * object must be an instance of <code>CollationKey</code> or an exception
123       * will be thrown.  An integer is returned which indicates whether the
124       * specified object is less than, greater than, or equal to this object.
125       *
126       * @param obj The <code>Object</code> to compare against this one.
127       *
128       * @return A negative integer if this object is less than the specified object, 0 if it is equal or a positive integer if it is greater than the specified object.
129       */
130      public int compareTo (Object obj)
131      {
132        return compareTo ((CollationKey) obj);
133      }
134    
135      /**
136     * This method tests the specified <code>Object</code> for equality with     * This method tests the specified <code>Object</code> for equality with
137     * this object.  This will be true if and only if:     * this object.  This will be true if and only if:
138     * <p>     * <p>
# Line 163  public final class CollationKey implemen Line 149  public final class CollationKey implemen
149     *     *
150     * @return <code>true</code> if the specified object is equal to this one, <code>false</code> otherwise.     * @return <code>true</code> if the specified object is equal to this one, <code>false</code> otherwise.
151     */     */
152    public boolean equals(Object obj)    public boolean equals (Object obj)
153    {    {
154      if (obj == null)      if (obj == null)
155        return(false);        return(false);
# Line 186  public final class CollationKey implemen Line 172  public final class CollationKey implemen
172    }    }
173    
174    /**    /**
175       * This method returns the <code>String</code> that this object was created
176       * from.
177       *
178       * @return The source <code>String</code> for this object.
179       */
180      public String getSourceString ()
181      {
182        return str;
183      }
184    
185      /**
186     * This method returns a hash value for this object.  The hash value     * This method returns a hash value for this object.  The hash value
187     * returned will be the hash code of the bit key so that identical bit     * returned will be the hash code of the bit key so that identical bit
188     * keys will return the same value.     * keys will return the same value.
189     *     *
190     * @return A hash value for this object.     * @return A hash value for this object.
191     */     */
192    public int hashCode()    public int hashCode ()
193      {
194        return key.hashCode();
195      }
196      
197      /**
198       * This method returns the collation bit sequence as a byte array.
199       *
200       * @param A byte array containing the collation bit sequence.
201       */
202      public byte[] toByteArray ()
203    {    {
204      return(key.hashCode());      return key;
205    }    }
206  }  }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26