]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/output/template/IfStatement.java
upd: rename package name and all references to it
[gigi.git] / src / org / cacert / gigi / output / template / IfStatement.java
diff --git a/src/org/cacert/gigi/output/template/IfStatement.java b/src/org/cacert/gigi/output/template/IfStatement.java
deleted file mode 100644 (file)
index 1b49f3b..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.cacert.gigi.output.template;
-
-import java.io.PrintWriter;
-import java.util.Collection;
-import java.util.Map;
-
-import org.cacert.gigi.localisation.Language;
-
-/**
- * One ore two {@link Outputable}s that are emitted conditionally if a given
- * variable is neither <code>null</code> nor {@link Boolean#FALSE}.
- */
-public final class IfStatement implements Translatable {
-
-    private final String variable;
-
-    private final TemplateBlock iftrue;
-
-    private final TemplateBlock iffalse;
-
-    /**
-     * Creates a new {@link IfStatement} with an empty else-part.
-     * 
-     * @param variable
-     *            the variable to check.
-     * @param body
-     *            the body to emit conditionally.
-     */
-    public IfStatement(String variable, TemplateBlock body) {
-        this.variable = variable;
-        this.iftrue = body;
-        this.iffalse = null;
-    }
-
-    /**
-     * Creates a new {@link IfStatement} with an else-block.
-     * 
-     * @param variable
-     *            the variable to check.
-     * @param iftrue
-     *            the block to emit if the check succeeds.
-     * @param iffalse
-     *            the block to emit if the check fails.
-     */
-    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<String, Object> vars) {
-        Object o = vars.get(variable);
-
-        if ( !(o == null || Boolean.FALSE.equals(o))) {
-            iftrue.output(out, l, vars);
-        } else if (iffalse != null) {
-            iffalse.output(out, l, vars);
-        }
-    }
-
-    @Override
-    public void addTranslations(Collection<String> s) {
-        iftrue.addTranslations(s);
-        if (iffalse != null) {
-            iffalse.addTranslations(s);
-        }
-    }
-
-}