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

Method rot_map_iterator

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

Source from the content-addressed store, hash-verified

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