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

Method rot_map_iterator

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

Source from the content-addressed store, hash-verified

832 }
833
834 protected List<ST> rot_map_iterator(InstanceScope scope, Iterator<?> attr, List<ST> prototypes) {
835 List<ST> mapped = new ArrayList<ST>();
836 Iterator<?> iter = attr;
837 int i0 = 0;
838 int i = 1;
839 int ti = 0;
840 while ( iter.hasNext() ) {
841 Object iterValue = iter.next();
842 if ( iterValue==null ) {
843 mapped.add(null);
844 continue;
845 }
846
847 int templateIndex = ti% prototypes.size(); // rotate through
848 ti++;
849 ST proto = prototypes.get(templateIndex);
850 ST st = group.createStringTemplateInternally(proto);
851 setFirstArgument(scope, st, iterValue);
852 if ( st.impl.isAnonSubtemplate) {
853 st.rawSetAttribute("i0", i0);
854 st.rawSetAttribute("i", i);
855 }
856 mapped.add(st);
857 i0++;
858 i++;
859 }
860 return mapped;
861 }
862
863 /**
864 * 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