@Override public String toSource(int depth) { String pad = makeIndent(depth); StringBuilder sb = new StringBuilder(32); sb.append(pad); sb.append("if ("); sb.append(condition.toSource(0)); sb.append(") "); if (thenPart.getType() != Token.BLOCK) { sb.append("\n").append(makeIndent(depth + 1)); } sb.append(thenPart.toSource(depth).trim()); if (elsePart != null) { if (thenPart.getType() != Token.BLOCK) { sb.append("\n").append(pad).append("else "); } else { sb.append(" else "); } if (elsePart.getType() != Token.BLOCK && elsePart.getType() != Token.IF) { sb.append("\n").append(makeIndent(depth + 1)); } sb.append(elsePart.toSource(depth).trim()); } sb.append("\n"); return sb.toString(); }
@Override public String toSource(int depth) { String pad = makeIndent(depth); StringBuilder sb = new StringBuilder(32); sb.append(pad); sb.append("if ("); sb.append(condition.toSource(0)); sb.append(") "); if (thenPart.getType() != Token.BLOCK) { sb.append("\n").append(makeIndent(depth + 1)); } sb.append(thenPart.toSource(depth).trim()); if (elsePart != null) { if (thenPart.getType() != Token.BLOCK) { sb.append("\n").append(pad).append("else "); } else { sb.append(" else "); } if (elsePart.getType() != Token.BLOCK && elsePart.getType() != Token.IF) { sb.append("\n").append(makeIndent(depth + 1)); } sb.append(elsePart.toSource(depth).trim()); } sb.append("\n"); return sb.toString(); }
@Override public String toSource(int depth) { String pad = makeIndent(depth); StringBuilder sb = new StringBuilder(32); sb.append(pad); sb.append("if ("); sb.append(condition.toSource(0)); sb.append(") "); if (thenPart.getType() != Token.BLOCK) { sb.append("\n").append(makeIndent(depth + 1)); } sb.append(thenPart.toSource(depth).trim()); if (elsePart != null) { if (thenPart.getType() != Token.BLOCK) { sb.append("\n").append(pad).append("else "); } else { sb.append(" else "); } if (elsePart.getType() != Token.BLOCK && elsePart.getType() != Token.IF) { sb.append("\n").append(makeIndent(depth + 1)); } sb.append(elsePart.toSource(depth).trim()); } sb.append("\n"); return sb.toString(); }
@Override public String toSource(int depth) { String pad = makeIndent(depth); StringBuilder sb = new StringBuilder(32); sb.append(pad); sb.append("if ("); sb.append(condition.toSource(0)); sb.append(") "); if (thenPart.getType() != Token.BLOCK) { sb.append("\n").append(makeIndent(depth + 1)); } sb.append(thenPart.toSource(depth).trim()); if (elsePart != null) { if (thenPart.getType() != Token.BLOCK) { sb.append("\n").append(pad).append("else "); } else { sb.append(" else "); } if (elsePart.getType() != Token.BLOCK && elsePart.getType() != Token.IF) { sb.append("\n").append(makeIndent(depth + 1)); } sb.append(elsePart.toSource(depth).trim()); } sb.append("\n"); return sb.toString(); }