@Override public String generate(Context context) { if (generatedCache != null) return generatedCache; final StringBuilder builder = new StringBuilder("while (") .append(getCondition().generate(context)).append(") {\n"); if (getBlock() != null) { builder.append(getBlock().generate(context)); } builder.append("\n}"); return generatedCache = builder.toString(); } }
@Override public String generate(Context context) { final StringBuilder builder = new StringBuilder("do {\n"); if (getBlock() != null) { builder.append(getBlock().generate(context)); } builder.append("\n} while (").append(getCondition().generate(context)).append(");\n"); return builder.toString(); } }
@Override public String generate(Context context) { if (generatedCache != null) return generatedCache; final StringBuilder builder = new StringBuilder("while (") .append(getCondition().generate(context)).append(") {\n"); if (getBlock() != null) { builder.append(getBlock().generate(context)); } builder.append("\n}"); return generatedCache = builder.toString(); } }
@Override public String generate(Context context) { final StringBuilder builder = new StringBuilder("do {\n"); if (getBlock() != null) { builder.append(getBlock().generate(context)); } builder.append("\n} while (").append(getCondition().generate(context)).append(");\n"); return builder.toString(); } }
@Override public String generate(Context context) { if (generatedCache != null) return generatedCache; final StringBuilder buf = new StringBuilder("try {\n"); buf.append(block.generate(context)).append("\n} "); if (!catchBlocks.isEmpty()) { for (final Variable exception : catchBlocks.keySet()) { final Context ctx = Context.create(context).addVariable(exception); buf.append("catch (").append(exception.generate(ctx)).append(") ") .append("{\n") .append(catchBlocks.get(exception).generate(ctx)) .append("\n} "); } } else if (finallyBlock == null) { finallyBlock = new BlockStatement(); } if (finallyBlock != null) { final Context ctx = Context.create(context); buf.append(" finally {\n").append(finallyBlock.generate(ctx)).append("\n}\n"); } return generatedCache = buf.toString(); } }
@Override public String generate(Context context) { if (generatedCache != null) return generatedCache; final StringBuilder buf = new StringBuilder("try {\n"); buf.append(block.generate(context)).append("\n} "); if (!catchBlocks.isEmpty()) { for (final Variable exception : catchBlocks.keySet()) { final Context ctx = Context.create(context).addVariable(exception); buf.append("catch (").append(exception.generate(ctx)).append(") ") .append("{\n") .append(catchBlocks.get(exception).generate(ctx)) .append("\n} "); } } else if (finallyBlock == null) { finallyBlock = new BlockStatement(); } if (finallyBlock != null) { final Context ctx = Context.create(context); buf.append(" finally {\n").append(finallyBlock.generate(ctx)).append("\n}\n"); } return generatedCache = buf.toString(); } }
@Override public String generate(Context context) { if (generatedCache != null) return generatedCache; final StringBuilder builder = new StringBuilder("if "); builder.append("(").append(getCondition().generate(context)).append(") "); builder.append("{\n"); if (getBlock() != null) { builder.append(getBlock().generate(Context.create(context))); } builder.append("\n} "); if (elseIfBlock != null) { builder.append("else ").append(elseIfBlock.generate(Context.create(context))); return builder.toString(); } if (elseBlock != null && !elseBlock.isEmpty()) { builder.append("else {\n").append(elseBlock.generate(Context.create(context))).append("\n} "); return builder.toString(); } return generatedCache = builder.toString(); } }
@Override public String generate(Context context) { if (generatedCache != null) return generatedCache; final StringBuilder builder = new StringBuilder("if "); builder.append("(").append(getCondition().generate(context)).append(") "); builder.append("{\n"); if (getBlock() != null) { builder.append(getBlock().generate(Context.create(context))); } builder.append("\n} "); if (elseIfBlock != null) { builder.append("else ").append(elseIfBlock.generate(Context.create(context))); return builder.toString(); } if (elseBlock != null && !elseBlock.isEmpty()) { builder.append("else {\n").append(elseBlock.generate(Context.create(context))).append("\n} "); return builder.toString(); } return generatedCache = builder.toString(); } }
.append(getBlock().generate(Context.create(context))) .append("\n}\n");
.append(getBlock().generate(Context.create(context))) .append("\n}\n");