(InstanceScope scope, Iterator<?> attr, List<ST> prototypes)
| 808 | } |
| 809 | |
| 810 | protected List<ST> rot_map_iterator(InstanceScope scope, Iterator<?> attr, List<ST> prototypes) { |
| 811 | List<ST> mapped = new ArrayList<ST>(); |
| 812 | Iterator<?> iter = attr; |
| 813 | int i0 = 0; |
| 814 | int i = 1; |
| 815 | int ti = 0; |
| 816 | while ( iter.hasNext() ) { |
| 817 | Object iterValue = iter.next(); |
| 818 | if ( iterValue==null ) { |
| 819 | mapped.add(null); |
| 820 | continue; |
| 821 | } |
| 822 | |
| 823 | int templateIndex = ti% prototypes.size(); // rotate through |
| 824 | ti++; |
| 825 | ST proto = prototypes.get(templateIndex); |
| 826 | ST st = group.createStringTemplateInternally(proto); |
| 827 | setFirstArgument(scope, st, iterValue); |
| 828 | if ( st.impl.isAnonSubtemplate ) { |
| 829 | st.rawSetAttribute("i0", i0); |
| 830 | st.rawSetAttribute("i", i); |
| 831 | } |
| 832 | mapped.add(st); |
| 833 | i0++; |
| 834 | i++; |
| 835 | } |
| 836 | return mapped; |
| 837 | } |
| 838 | |
| 839 | /** |
| 840 | * Renders expressions of the form {@code <names,phones:{n,p | ...}>} or |
no test coverage detected