< prev index next >

src/com/sun/jct/utils/indexgen/Main.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


 504             mapOut.println("<map version=\"1.0\">");
 505         }
 506 
 507         PrintWriter htmlOut = (htmlOutFile == null ? null
 508                                : new PrintWriter(new BufferedWriter(new FileWriter(htmlOutFile))));
 509         if (htmlOut != null) {
 510             htmlOut.println("<!DOCTYPE HTML>");
 511             htmlOut.println("<html>");
 512             htmlOut.println("<head>");
 513             htmlOut.println("<title>");
 514             htmlOut.println("Index");
 515             htmlOut.println("</title>");
 516             htmlOut.println("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"../jthelp.css\" TITLE=\"Style\">");
 517             htmlOut.println("</head>");
 518             htmlOut.println("<body>");
 519             htmlOut.println("<h1>Index</h1>");
 520         }
 521 
 522         char currLetter = 0;
 523 
 524         for (Iterator iter = root.iterator(); iter.hasNext(); ) {
 525             Node node = (Node) (iter.next());
 526             String name = node.getName();
 527             char initial = Character.toUpperCase(name.charAt(0));
 528             if (Character.isLetter(initial) && initial != currLetter) {
 529                 for (char c = (currLetter == 0 ? 'A' : (char) (currLetter + 1));
 530                      c <= initial; c++) {
 531                     if (htmlOut != null) {
 532                         htmlOut.println("");
 533                         htmlOut.println("<p class=\"index0\">" + c + "</p>");
 534                     }
 535                 }
 536                 currLetter = initial;
 537             }
 538 
 539             write(indexOut, mapOut, htmlOut, node, 0);
 540         }
 541 
 542         if (htmlOut != null) {
 543             for (char c = (char) (currLetter + 1); c <= 'Z'; c++)
 544                 htmlOut.println("<p class=\"index0\">" + c + "</p>");
 545             htmlOut.println("</body>");


 580         if (xmlOut != null) {
 581             xmlOut.write("<indexitem text=\"");
 582             xmlOut.write(escapeString(node.getName()));
 583             xmlOut.write("\" ");
 584             if (href != null) {
 585                 xmlOut.write(" target=\"");
 586                 xmlOut.write(escapeString(getTarget(href)));
 587                 xmlOut.write("\" ");
 588                 if (mapOut != null) {
 589                     mapOut.println("<mapID target=\""
 590                                    + escapeString(getTarget(href))
 591                                    + "\" url=\""
 592                                    + escapeString(href)
 593                                    + "\" />");
 594                 }
 595             }
 596             xmlOut.println(node.getChildCount() == 0 ? "/>" : ">");
 597         }
 598 
 599         if (node.getChildCount() > 0) {
 600             for (Iterator iter = node.iterator(); iter.hasNext(); ) {
 601                 Node child = (Node) (iter.next());
 602                 write(xmlOut, mapOut, htmlOut, child, depth + 1);
 603             }
 604 
 605             if (xmlOut != null)
 606                 xmlOut.println("</indexitem>");
 607         }
 608     }
 609 
 610     private static String[] split(String s, char sep) {
 611         Vector<String> v = new Vector<>();
 612         int start = -1;
 613         for (int i = 0; i < s.length(); i++) {
 614             char c = s.charAt(i);
 615             if (c == sep)  {
 616                 if (start != -1)
 617                     v.addElement(s.substring(start, i).trim());
 618                 start = -1;
 619             } else {
 620                 if (start == -1)
 621                     start = i;




 504             mapOut.println("<map version=\"1.0\">");
 505         }
 506 
 507         PrintWriter htmlOut = (htmlOutFile == null ? null
 508                                : new PrintWriter(new BufferedWriter(new FileWriter(htmlOutFile))));
 509         if (htmlOut != null) {
 510             htmlOut.println("<!DOCTYPE HTML>");
 511             htmlOut.println("<html>");
 512             htmlOut.println("<head>");
 513             htmlOut.println("<title>");
 514             htmlOut.println("Index");
 515             htmlOut.println("</title>");
 516             htmlOut.println("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"../jthelp.css\" TITLE=\"Style\">");
 517             htmlOut.println("</head>");
 518             htmlOut.println("<body>");
 519             htmlOut.println("<h1>Index</h1>");
 520         }
 521 
 522         char currLetter = 0;
 523 
 524         for (Iterator<Node> iter = root.iterator(); iter.hasNext(); ) {
 525             Node node = (iter.next());
 526             String name = node.getName();
 527             char initial = Character.toUpperCase(name.charAt(0));
 528             if (Character.isLetter(initial) && initial != currLetter) {
 529                 for (char c = (currLetter == 0 ? 'A' : (char) (currLetter + 1));
 530                      c <= initial; c++) {
 531                     if (htmlOut != null) {
 532                         htmlOut.println("");
 533                         htmlOut.println("<p class=\"index0\">" + c + "</p>");
 534                     }
 535                 }
 536                 currLetter = initial;
 537             }
 538 
 539             write(indexOut, mapOut, htmlOut, node, 0);
 540         }
 541 
 542         if (htmlOut != null) {
 543             for (char c = (char) (currLetter + 1); c <= 'Z'; c++)
 544                 htmlOut.println("<p class=\"index0\">" + c + "</p>");
 545             htmlOut.println("</body>");


 580         if (xmlOut != null) {
 581             xmlOut.write("<indexitem text=\"");
 582             xmlOut.write(escapeString(node.getName()));
 583             xmlOut.write("\" ");
 584             if (href != null) {
 585                 xmlOut.write(" target=\"");
 586                 xmlOut.write(escapeString(getTarget(href)));
 587                 xmlOut.write("\" ");
 588                 if (mapOut != null) {
 589                     mapOut.println("<mapID target=\""
 590                                    + escapeString(getTarget(href))
 591                                    + "\" url=\""
 592                                    + escapeString(href)
 593                                    + "\" />");
 594                 }
 595             }
 596             xmlOut.println(node.getChildCount() == 0 ? "/>" : ">");
 597         }
 598 
 599         if (node.getChildCount() > 0) {
 600             for (Iterator<Node> iter = node.iterator(); iter.hasNext(); ) {
 601                 Node child = (iter.next());
 602                 write(xmlOut, mapOut, htmlOut, child, depth + 1);
 603             }
 604 
 605             if (xmlOut != null)
 606                 xmlOut.println("</indexitem>");
 607         }
 608     }
 609 
 610     private static String[] split(String s, char sep) {
 611         Vector<String> v = new Vector<>();
 612         int start = -1;
 613         for (int i = 0; i < s.length(); i++) {
 614             char c = s.charAt(i);
 615             if (c == sep)  {
 616                 if (start != -1)
 617                     v.addElement(s.substring(start, i).trim());
 618                 start = -1;
 619             } else {
 620                 if (start == -1)
 621                     start = i;


< prev index next >