Ejemplo n.º 1
0
 public StringBuffer printStatement(int tab, StringBuffer output) {
   printIndent(tab, output);
   output.append("assert "); // $NON-NLS-1$
   this.assertExpression.printExpression(0, output);
   if (this.exceptionArgument != null) {
     output.append(": "); // $NON-NLS-1$
     this.exceptionArgument.printExpression(0, output);
   }
   return output.append(';');
 }
  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;
  }
 public StringBuffer printExpression(int indent, StringBuffer output) {
   if (this.type != null) { // type null for enum constant initializations
     output.append("new "); // $NON-NLS-1$
   }
   if (this.typeArguments != null) {
     output.append('<');
     int max = this.typeArguments.length - 1;
     for (int j = 0; j < max; j++) {
       this.typeArguments[j].print(0, output);
       output.append(", "); // $NON-NLS-1$
     }
     this.typeArguments[max].print(0, output);
     output.append('>');
   }
   if (this.type != null) { // type null for enum constant initializations
     this.type.printExpression(0, output);
   }
   output.append('(');
   if (this.arguments != null) {
     for (int i = 0; i < this.arguments.length; i++) {
       if (i > 0) output.append(", "); // $NON-NLS-1$
       this.arguments[i].printExpression(0, output);
     }
   }
   return output.append(')');
 }
Ejemplo n.º 5
0
  public StringBuffer printExpression(int indent, StringBuffer output) {

    output.append('{');
    if (this.expressions != null) {
      int j = 20;
      for (int i = 0; i < this.expressions.length; i++) {
        if (i > 0) output.append(", "); // $NON-NLS-1$
        this.expressions[i].printExpression(0, output);
        j--;
        if (j == 0) {
          output.append('\n');
          printIndent(indent + 1, output);
          j = 20;
        }
      }
    }
    return output.append('}');
  }
Ejemplo n.º 6
0
  public StringBuffer printStatement(int indent, StringBuffer output) {
    printIndent(indent, output).append("try \n"); // $NON-NLS-1$
    this.tryBlock.printStatement(indent + 1, output);

    // catches
    if (this.catchBlocks != null)
      for (int i = 0; i < this.catchBlocks.length; i++) {
        output.append('\n');
        printIndent(indent, output).append("catch ("); // $NON-NLS-1$
        this.catchArguments[i].print(0, output).append(") "); // $NON-NLS-1$
        this.catchBlocks[i].printStatement(indent + 1, output);
      }
    // finally
    if (this.finallyBlock != null) {
      output.append('\n');
      printIndent(indent, output).append("finally\n"); // $NON-NLS-1$
      this.finallyBlock.printStatement(indent + 1, output);
    }
    return output;
  }
  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;
  }