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

Method rot_map_iterator

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

Source from the content-addressed store, hash-verified

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