MCPcopy Create free account
hub / github.com/antlr/codebuff / rot_map_iterator

Method rot_map_iterator

output/java/1.4.12/Interpreter.java:830–857  ·  view source on GitHub ↗
(InstanceScope scope, Iterator<?> attr, List<ST> prototypes)

Source from the content-addressed store, hash-verified

828 }
829
830 protected List<ST> rot_map_iterator(InstanceScope scope, Iterator<?> attr, List<ST> prototypes) {
831 List<ST> mapped = new ArrayList<ST>();
832 Iterator<?> iter = attr;
833 int i0 = 0;
834 int i = 1;
835 int ti = 0;
836 while ( iter.hasNext() ) {
837 Object iterValue = iter.next();
838 if ( iterValue==null ) {
839 mapped.add(null);
840 continue;
841 }
842
843 int templateIndex = ti% prototypes.size(); // rotate through
844 ti++;
845 ST proto = prototypes.get(templateIndex);
846 ST st = group.createStringTemplateInternally(proto);
847 setFirstArgument(scope, st, iterValue);
848 if ( st.impl.isAnonSubtemplate) {
849 st.rawSetAttribute("i0", i0);
850 st.rawSetAttribute("i", i);
851 }
852 mapped.add(st);
853 i0++;
854 i++;
855 }
856 return mapped;
857 }
858
859 /**
860 * Renders expressions of the form {@code <names,phones:{n,p | ...}>} or

Callers 1

rot_mapMethod · 0.95

Calls 8

setFirstArgumentMethod · 0.95
rawSetAttributeMethod · 0.95
nextMethod · 0.65
addMethod · 0.65
sizeMethod · 0.65
getMethod · 0.65
hasNextMethod · 0.45

Tested by

no test coverage detected