]> WPIA git - gigi.git/blob - src/org/cacert/gigi/output/template/OutputableArrayIterable.java
5a78e73bfa56a40eae55f9ef07287c4b9816e408
[gigi.git] / src / org / cacert / gigi / output / template / OutputableArrayIterable.java
1 package org.cacert.gigi.output.template;
2
3 import java.util.Map;
4
5 import org.cacert.gigi.localisation.Language;
6
7 public class OutputableArrayIterable implements IterableDataset {
8
9     Object[] content;
10
11     String targetName;
12
13     int index = 0;
14
15     public OutputableArrayIterable(Object[] content, String targetName) {
16         this.content = content;
17         this.targetName = targetName;
18     }
19
20     @Override
21     public boolean next(Language l, Map<String, Object> vars) {
22         if (index >= content.length) {
23             return false;
24         }
25         vars.put(targetName, content[index]);
26         vars.put("i", index);
27         index++;
28         return true;
29     }
30
31 }