X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;ds=sidebyside;f=src%2Forg%2Fcacert%2Fgigi%2Foutput%2Ftemplate%2FIfStatement.java;h=0347a363db8798f3d98356fc68bbdea737c19d1f;hb=7f0229055197cf353db26e61b1f5d84ddf5b58df;hp=db0cbe11f07f20132ebdad1503ed82695686f849;hpb=cd14b85c60f736a643842b421b11f41d8fca86c7;p=gigi.git diff --git a/src/org/cacert/gigi/output/template/IfStatement.java b/src/org/cacert/gigi/output/template/IfStatement.java index db0cbe11..0347a363 100644 --- a/src/org/cacert/gigi/output/template/IfStatement.java +++ b/src/org/cacert/gigi/output/template/IfStatement.java @@ -9,18 +9,31 @@ public final class IfStatement implements Outputable { private final String variable; - private final TemplateBlock body; + private final TemplateBlock iftrue; + + private final TemplateBlock iffalse; public IfStatement(String variable, TemplateBlock body) { this.variable = variable; - this.body = body; + this.iftrue = body; + this.iffalse = null; + } + + public IfStatement(String variable, TemplateBlock iftrue, TemplateBlock iffalse) { + this.variable = variable; + this.iftrue = iftrue; + this.iffalse = iffalse; } @Override public void output(PrintWriter out, Language l, Map vars) { Object o = vars.get(variable); - if ( !(o == Boolean.FALSE || o == null)) { - body.output(out, l, vars); + + if ( !(o == null || Boolean.FALSE.equals(o))) { + iftrue.output(out, l, vars); + } else if (iffalse != null) { + iffalse.output(out, l, vars); } } + }