X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Foutput%2Ftemplate%2FForeachStatement.java;fp=src%2Forg%2Fcacert%2Fgigi%2Foutput%2Ftemplate%2FForeachStatement.java;h=0000000000000000000000000000000000000000;hp=4c8b1027b5f7dfb3df420b309fffe699fad94d26;hb=bccd4cc0dba0f89aa045b113bac46eb8cc1dab4e;hpb=c9ed09f0007fc2c813815be927a5a24b23dab83c diff --git a/src/org/cacert/gigi/output/template/ForeachStatement.java b/src/org/cacert/gigi/output/template/ForeachStatement.java deleted file mode 100644 index 4c8b1027..00000000 --- a/src/org/cacert/gigi/output/template/ForeachStatement.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.cacert.gigi.output.template; - -import java.io.PrintWriter; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.cacert.gigi.localisation.Language; - -/** - * Outputs an {@link Outputable} multiple times based on a given - * {@link IterableDataset}. - */ -public final class ForeachStatement implements Translatable { - - private final String variable; - - private final TemplateBlock body; - - /** - * Creates a new {@link ForeachStatement}. - * - * @param variable - * the variable to take the {@link IterableDataset} from. - * @param body - * the body to output multiple times. - */ - public ForeachStatement(String variable, TemplateBlock body) { - this.variable = variable; - this.body = body; - } - - @Override - public void output(PrintWriter out, Language l, Map vars) { - Object o = vars.get(variable); - if (o instanceof IterableDataset) { - IterableDataset id = (IterableDataset) o; - Map subcontext = new HashMap(vars); - while (id.next(l, subcontext)) { - body.output(out, l, subcontext); - } - } - } - - @Override - public void addTranslations(Collection s) { - body.addTranslations(s); - } -}