]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/output/template/OutputableArrayIterable.java
Advance the domain issuing form to prepare for entering ping methods.
[gigi.git] / src / org / cacert / gigi / output / template / OutputableArrayIterable.java
diff --git a/src/org/cacert/gigi/output/template/OutputableArrayIterable.java b/src/org/cacert/gigi/output/template/OutputableArrayIterable.java
new file mode 100644 (file)
index 0000000..5a78e73
--- /dev/null
@@ -0,0 +1,31 @@
+package org.cacert.gigi.output.template;
+
+import java.util.Map;
+
+import org.cacert.gigi.localisation.Language;
+
+public class OutputableArrayIterable implements IterableDataset {
+
+    Object[] content;
+
+    String targetName;
+
+    int index = 0;
+
+    public OutputableArrayIterable(Object[] content, String targetName) {
+        this.content = content;
+        this.targetName = targetName;
+    }
+
+    @Override
+    public boolean next(Language l, Map<String, Object> vars) {
+        if (index >= content.length) {
+            return false;
+        }
+        vars.put(targetName, content[index]);
+        vars.put("i", index);
+        index++;
+        return true;
+    }
+
+}