< prev index next >

make/jdk/src/classes/build/tools/jdwpgen/RepeatNode.java

Print this page




  27 
  28 import java.util.*;
  29 import java.io.*;
  30 
  31 class RepeatNode extends AbstractTypeNode {
  32 
  33     Node member = null;
  34 
  35     void constrain(Context ctx) {
  36         super.constrain(ctx);
  37         if (components.size() != 1) {
  38             error("Repeat must have exactly one member, use Group for more");
  39         }
  40         member = components.get(0);
  41         if (!(member instanceof TypeNode)) {
  42             error("Repeat member must be type specifier");
  43         }
  44     }
  45 
  46     void document(PrintWriter writer) {
  47         writer.println("<tr>");
  48         writer.println("<td>" + indentElement(structIndent, "int"));
  49         writer.println("<th scope=\"row\"><i>" + name() + "</i>");
  50         writer.println("<td>" + comment() + "&nbsp;");
  51         writer.println("</tr>");
  52 
  53         writer.println("<tr>");
  54         writer.println("<th colspan=\"3\" scope=\"rowgroup\">"
  55                 + indentElement(structIndent, "Repeated <i>" + name() + "</i> times:"));
  56         writer.println("</tr>");
  57 
  58         ++structIndent;
  59         member.document(writer);
  60         --structIndent;
  61     }
  62 
  63     String docType() {
  64         return "-BOGUS-"; // should never call this
  65     }
  66 
  67     String javaType() {
  68         return member.javaType() + "[]";
  69     }
  70 
  71     public void genJavaWrite(PrintWriter writer, int depth,
  72                              String writeLabel) {
  73         genJavaDebugWrite(writer, depth, writeLabel, "\"\"");
  74         indent(writer, depth);
  75         writer.println("ps.writeInt(" + writeLabel + ".length);");
  76         indent(writer, depth);
  77         writer.println("for (int i = 0; i < " + writeLabel + ".length; i++) {;");




  27 
  28 import java.util.*;
  29 import java.io.*;
  30 
  31 class RepeatNode extends AbstractTypeNode {
  32 
  33     Node member = null;
  34 
  35     void constrain(Context ctx) {
  36         super.constrain(ctx);
  37         if (components.size() != 1) {
  38             error("Repeat must have exactly one member, use Group for more");
  39         }
  40         member = components.get(0);
  41         if (!(member instanceof TypeNode)) {
  42             error("Repeat member must be type specifier");
  43         }
  44     }
  45 
  46     void document(PrintWriter writer) {
  47         docRowStart(writer);
  48         writer.println("<td colspan=" +
  49                        (maxStructIndent - structIndent) + ">");
  50         writer.println("int<td><i>" + name + "</i><td>" +
  51                        comment() + "&nbsp;");
  52         docRowStart(writer);
  53         writer.println("<td colspan=" +
  54                        (maxStructIndent - structIndent + 2) + ">");
  55         writer.println("Repeated <i>" + name + "</i> times:");


  56         ++structIndent;
  57         member.document(writer);
  58         --structIndent;
  59     }
  60 
  61     String docType() {
  62         return "-BOGUS-"; // should never call this
  63     }
  64 
  65     String javaType() {
  66         return member.javaType() + "[]";
  67     }
  68 
  69     public void genJavaWrite(PrintWriter writer, int depth,
  70                              String writeLabel) {
  71         genJavaDebugWrite(writer, depth, writeLabel, "\"\"");
  72         indent(writer, depth);
  73         writer.println("ps.writeInt(" + writeLabel + ".length);");
  74         indent(writer, depth);
  75         writer.println("for (int i = 0; i < " + writeLabel + ".length; i++) {;");


< prev index next >