]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - jars/icu4j-52_1/tools/build/src/com/ibm/icu/dev/tool/docs/APIInfo.java
Upgrade ICU4J.
[Dictionary.git] / jars / icu4j-52_1 / tools / build / src / com / ibm / icu / dev / tool / docs / APIInfo.java
similarity index 94%
rename from jars/icu4j-4_8_1_1/tools/build/src/com/ibm/icu/dev/tool/docs/APIInfo.java
rename to jars/icu4j-52_1/tools/build/src/com/ibm/icu/dev/tool/docs/APIInfo.java
index 574404894664d68ef56002b3daa0db29558bf11b..75083c151332bc5b0e13a2f107db23a977ab82d9 100644 (file)
@@ -1,6 +1,6 @@
 /**
  *******************************************************************************
- * Copyright (C) 2005-2010, International Business Machines Corporation and    *
+ * Copyright (C) 2005-2013, International Business Machines Corporation and    *
  * others. All Rights Reserved.                                                *
  *******************************************************************************
  */
@@ -297,10 +297,10 @@ class APIInfo {
      * APIInfo.  Throws IOException if EOF is encountered before the
      * token is complete (i.e. before the separator character is
      * encountered) or if the token exceeds the maximum length of
-     * 255 chars.
+     * 511 chars.
      */
     public static String readToken(BufferedReader r) throws IOException {
-        char[] buf = new char[256];
+        char[] buf = new char[512];
         int i = 0;
         for (; i < buf.length; ++i) {
             int c = r.read();
@@ -424,8 +424,12 @@ class APIInfo {
     }
 
     public void print(PrintWriter pw, boolean detail, boolean html, boolean withStatus) {
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
+        format(buf, detail, html, withStatus);
+        pw.print(buf.toString());
+    }
 
+    public void format(StringBuilder buf, boolean detail, boolean html, boolean withStatus) {
         // remove all occurrences of icu packages from the param string
         // fortunately, all the packages have 4 chars (lang, math, text, util).
         String xsig = sig;
@@ -448,14 +452,26 @@ class APIInfo {
         for (int i = (withStatus ? STA : VIS) ; i < CAT; ++i) { // include status
             String s = get(i, false);
             if (s != null && s.length() > 0) {
-                if (html && s.indexOf("internal") != -1) {
-                    buf.append("<span style='color:red'>");
-                    buf.append(s);
-                    buf.append("</span>");
-                } else {
-                    buf.append(s);
-                    buf.append(' ');
+                if (html) {
+                    s = s.trim();
+                    if (i == STA) {
+                        String color = null;
+                        if (s.startsWith("(internal)")) {
+                            color = "red";
+                        } else if (s.startsWith("(draft)")) {
+                            color = "orange";
+                        } else if (s.startsWith("(stable)")) {
+                            color = "green";
+                        } else if (s.startsWith("(deprecated)")) {
+                            color = "gray";
+                        }
+                        if (color != null) {
+                            s = "<span style='color:" + color + "'>" + s + "</span>";
+                        }
+                    }
                 }
+                buf.append(s);
+                buf.append(' ');
             }
         }
 
@@ -507,8 +523,6 @@ class APIInfo {
             buf.append(xsig.substring(n));
             break;
         }
-
-        pw.print(buf.toString());
     }
 
     public void println(PrintWriter pw, boolean detail, boolean html) {