public StringBuffer printExpression(int indent, StringBuffer output) {

    output.append("new "); // $NON-NLS-1$
    type.print(0, output);
    for (int i = 0; i < dimensions.length; i++) {
      if (dimensions[i] == null) output.append("[]"); // $NON-NLS-1$
      else {
        output.append('[');
        dimensions[i].printExpression(0, output);
        output.append(']');
      }
    }
    if (initializer != null) initializer.printExpression(0, output);
    return output;
  }
  public StringBuffer printBody(int indent, StringBuffer output) {

    if (isAbstract() || (this.modifiers & ExtraCompilerModifiers.AccSemicolonBody) != 0)
      return output.append(';');

    output.append(" {"); // $NON-NLS-1$
    if (this.statements != null) {
      for (int i = 0; i < this.statements.length; i++) {
        output.append('\n');
        this.statements[i].printStatement(indent, output);
      }
    }
    output.append('\n');
    printIndent(indent == 0 ? 0 : indent - 1, output).append('}');
    return output;
  }
Пример #3
0
 public String toString() {
   StringBuffer buffer = new StringBuffer();
   buffer.append('@');
   buffer.append(this.typename);
   if (this.pairs != null) {
     buffer.append('(');
     buffer.append("\n\t"); // $NON-NLS-1$
     for (int i = 0, len = this.pairs.length; i < len; i++) {
       if (i > 0) buffer.append(",\n\t"); // $NON-NLS-1$
       buffer.append(this.pairs[i]);
     }
     buffer.append(')');
   }
   return buffer.toString();
 }
  public StringBuffer print(int tab, StringBuffer output) {

    if (this.javadoc != null) {
      this.javadoc.print(tab, output);
    }
    printIndent(tab, output);
    printModifiers(this.modifiers, output);
    if (this.annotations != null) {
      printAnnotations(this.annotations, output);
      output.append(' ');
    }

    TypeParameter[] typeParams = typeParameters();
    if (typeParams != null) {
      output.append('<');
      int max = typeParams.length - 1;
      for (int j = 0; j < max; j++) {
        typeParams[j].print(0, output);
        output.append(", "); // $NON-NLS-1$
      }
      typeParams[max].print(0, output);
      output.append('>');
    }

    printReturnType(0, output).append(this.selector).append('(');
    if (this.receiver != null) {
      this.receiver.print(0, output);
    }
    if (this.arguments != null) {
      for (int i = 0; i < this.arguments.length; i++) {
        if (i > 0 || this.receiver != null) output.append(", "); // $NON-NLS-1$
        this.arguments[i].print(0, output);
      }
    }
    output.append(')');
    if (this.thrownExceptions != null) {
      output.append(" throws "); // $NON-NLS-1$
      for (int i = 0; i < this.thrownExceptions.length; i++) {
        if (i > 0) output.append(", "); // $NON-NLS-1$
        this.thrownExceptions[i].print(0, output);
      }
    }
    printBody(tab + 1, output);
    return output;
  }