Add Android change comments to Collators.

Add missing Android-changed comments for Collator and related classes.

Bug: 65669355
Test: m (comment-only changes)
Change-Id: Icaabf728a701c1b1ffa26d780973be0a737a38a5
diff --git a/ojluni/src/main/java/java/text/CollationElementIterator.java b/ojluni/src/main/java/java/text/CollationElementIterator.java
index ad31f4a..fede747 100644
--- a/ojluni/src/main/java/java/text/CollationElementIterator.java
+++ b/ojluni/src/main/java/java/text/CollationElementIterator.java
@@ -107,10 +107,15 @@
      * Null order which indicates the end of string is reached by the
      * cursor.
      */
+    // Android-changed: use ICU CollationElementIterator constant.
     public final static int NULLORDER = android.icu.text.CollationElementIterator.NULLORDER;
 
+    // Android-removed: internal constructors.
+
+    // Android-added: ICU iterator to delegate to.
     private android.icu.text.CollationElementIterator icuIterator;
 
+   // Android-added: internal constructor taking an ICU CollationElementIterator.
     CollationElementIterator(android.icu.text.CollationElementIterator iterator) {
         icuIterator = iterator;
     }
@@ -121,6 +126,7 @@
      */
     public void reset()
     {
+        // Android-changed: delegate to ICU CollationElementIterator.
         icuIterator.reset();
     }
 
@@ -142,6 +148,7 @@
      */
     public int next()
     {
+        // Android-changed: delegate to ICU CollationElementIterator.
         return icuIterator.next();
     }
 
@@ -164,6 +171,7 @@
      */
     public int previous()
     {
+        // Android-changed: delegate to ICU CollationElementIterator.
         return icuIterator.previous();
     }
 
@@ -174,6 +182,7 @@
      */
     public final static int primaryOrder(int order)
     {
+        // Android-changed: delegate to ICU CollationElementIterator.
         return android.icu.text.CollationElementIterator.primaryOrder(order);
     }
     /**
@@ -183,6 +192,7 @@
      */
     public final static short secondaryOrder(int order)
     {
+        // Android-changed: delegate to ICU CollationElementIterator.
        return (short) android.icu.text.CollationElementIterator.secondaryOrder(order);
     }
     /**
@@ -192,6 +202,7 @@
      */
     public final static short tertiaryOrder(int order)
     {
+        // Android-changed: delegate to ICU CollationElementIterator.
         return (short) android.icu.text.CollationElementIterator.tertiaryOrder(order);
     }
 
@@ -213,6 +224,7 @@
     @SuppressWarnings("deprecation") // getBeginIndex, getEndIndex and setIndex are deprecated
     public void setOffset(int newOffset)
     {
+        // Android-changed: delegate to ICU CollationElementIterator.
         icuIterator.setOffset(newOffset);
     }
 
@@ -232,9 +244,11 @@
      */
     public int getOffset()
     {
+        // Android-changed: delegate to ICU CollationElementIterator.
         return icuIterator.getOffset();
     }
 
+
     /**
      * Return the maximum length of any expansion sequences that end
      * with the specified comparison order.
@@ -245,6 +259,7 @@
      */
     public int getMaxExpansion(int order)
     {
+        // Android-changed: delegate to ICU CollationElementIterator.
         return icuIterator.getMaxExpansion(order);
     }
 
@@ -256,6 +271,7 @@
      */
     public void setText(String source)
     {
+        // Android-changed: delegate to ICU CollationElementIterator.
         icuIterator.setText(source);
     }
 
@@ -267,6 +283,9 @@
      */
     public void setText(CharacterIterator source)
     {
+        // Android-changed: delegate to ICU CollationElementIterator.
         icuIterator.setText(source);
     }
+
+    // Android-removed: private helper methods and fields.
 }
diff --git a/ojluni/src/main/java/java/text/Collator.java b/ojluni/src/main/java/java/text/Collator.java
index 01e7dc9..ca3a220 100644
--- a/ojluni/src/main/java/java/text/Collator.java
+++ b/ojluni/src/main/java/java/text/Collator.java
@@ -226,10 +226,9 @@
      * @see java.util.Locale
      * @see java.util.ResourceBundle
      */
-    public static synchronized
-    Collator getInstance(Locale desiredLocale)
+    // Android-changed: Switched to ICU.
+    public static synchronized Collator getInstance(Locale desiredLocale)
     {
-        // Android-changed: Switched to ICU.
         if (desiredLocale == null) {
             throw new NullPointerException("locale == null");
         }
@@ -302,6 +301,7 @@
      */
     public boolean equals(String source, String target)
     {
+        // Android-changed: remove use of unnecessary EQUAL constant.
         return (compare(source, target) == 0);
     }
 
@@ -400,6 +400,7 @@
         return ICU.getAvailableCollatorLocales();
     }
 
+    // BEGIN Android-added: conversion method for decompositionMode constants.
     private int decompositionMode_Java_ICU(int mode) {
         switch (mode) {
             case Collator.CANONICAL_DECOMPOSITION:
@@ -422,7 +423,9 @@
         }
         return javaMode;
     }
+    // END Android-added: conversion method for decompositionMode constants.
 
+    // Android-changed: improve documentation.
     /**
      * Returns a new collator with the same decomposition mode and
      * strength value as this collator.
@@ -484,9 +487,13 @@
         icuColl = android.icu.text.RuleBasedCollator.getInstance(Locale.getDefault());
     }
 
+    // Android-added: ICU Collator this delegates to.
     android.icu.text.Collator icuColl;
 
+    // Android-added: protected constructor taking a Collator.
     Collator(android.icu.text.Collator icuColl) {
         this.icuColl = icuColl;
     }
+
+    // Android-removed: Fields and constants.
 }
diff --git a/ojluni/src/main/java/java/text/RuleBasedCollator.java b/ojluni/src/main/java/java/text/RuleBasedCollator.java
index a82080b..3f3c5bc0 100644
--- a/ojluni/src/main/java/java/text/RuleBasedCollator.java
+++ b/ojluni/src/main/java/java/text/RuleBasedCollator.java
@@ -242,10 +242,12 @@
  * @see        CollationElementIterator
  * @author     Helena Shih, Laura Werner, Richard Gillam
  */
-public class RuleBasedCollator extends Collator {
+public class RuleBasedCollator extends Collator{
+    // Android-added: protected constructor taking an ICU RuleBasedCollator.
     RuleBasedCollator(android.icu.text.RuleBasedCollator wrapper) {
         super(wrapper);
     }
+
     // IMPLEMENTATION NOTES:  The implementation of the collation algorithm is
     // divided across three classes: RuleBasedCollator, RBCollationTables, and
     // CollationElementIterator.  RuleBasedCollator contains the collator's
@@ -280,6 +282,7 @@
      * throw the ParseException because the '?' is not quoted.
      */
     public RuleBasedCollator(String rules) throws ParseException {
+        // BEGIN Android-changed: Switched to ICU.
         if (rules == null) {
             throw new NullPointerException("rules == null");
         }
@@ -295,8 +298,12 @@
              */
             throw new ParseException(e.getMessage(), -1);
         }
+        // BEGIN Android-changed: Switched to ICU.
     }
 
+    // Android-removed: (String rules, int decomp) constructor and copy constructor.
+
+    // Android-changed: document that getRules() won't return rules in common case.
     /**
      * Gets the table-based rules for the collation object.
      *
@@ -308,6 +315,7 @@
      */
     public String getRules()
     {
+        // Android-changed: Switched to ICU.
         return collAsICU().getRules();
     }
 
@@ -319,6 +327,7 @@
      * @see java.text.CollationElementIterator
      */
     public CollationElementIterator getCollationElementIterator(String source) {
+        // Android-changed: Switch to ICU and check for null value.
         if (source == null) {
             throw new NullPointerException("source == null");
         }
@@ -335,6 +344,7 @@
      */
     public CollationElementIterator getCollationElementIterator(
                                                 CharacterIterator source) {
+        // Android-changed: Switch to ICU and check for null value.
        if (source == null) {
             throw new NullPointerException("source == null");
         }
@@ -354,6 +364,7 @@
         if (source == null || target == null) {
             throw new NullPointerException();
         }
+        // Android-changed: Switched to ICU.
         return icuColl.compare(source, target);
     }
 
@@ -364,6 +375,7 @@
      */
     public synchronized CollationKey getCollationKey(String source)
     {
+        // Android-changed: Switched to ICU.
         if (source == null) {
             return null;
         }
@@ -374,6 +386,7 @@
      * Standard override; no change in semantics.
      */
     public Object clone() {
+        // Android-changed: remove special case for cloning.
         return super.clone();
     }
 
@@ -385,6 +398,7 @@
      */
     public boolean equals(Object obj) {
         if (obj == null) return false;
+        // Android-changed: delegate to super class, as that already compares icuColl.
         return super.equals(obj);
     }
 
@@ -392,10 +406,14 @@
      * Generates the hash code for the table-based collation object
      */
     public int hashCode() {
+        // Android-changed: Switched to ICU.
         return icuColl.hashCode();
     }
 
+    // Android-added: collAsIcu helper method.
     private android.icu.text.RuleBasedCollator collAsICU() {
         return (android.icu.text.RuleBasedCollator) icuColl;
     }
+
+    // Android-removed: private constants and fields.
 }