MCPcopy Index your code
hub / github.com/antlr/codebuff / rot_map_iterator

Method rot_map_iterator

output/java8/1.4.17/Interpreter.java:814–841  ·  view source on GitHub ↗
(InstanceScope scope, Iterator<?> attr, List<ST> prototypes)

Source from the content-addressed store, hash-verified

812 }
813
814 protected List<ST> rot_map_iterator(InstanceScope scope, Iterator<?> attr, List<ST> prototypes) {
815 List<ST> mapped = new ArrayList<ST>();
816 Iterator<?> iter = attr;
817 int i0 = 0;
818 int i = 1;
819 int ti = 0;
820 while ( iter.hasNext() ) {
821 Object iterValue = iter.next();
822 if ( iterValue==null ) {
823 mapped.add(null);
824 continue;
825 }
826
827 int templateIndex = ti% prototypes.size(); // rotate through
828 ti++;
829 ST proto = prototypes.get(templateIndex);
830 ST st = group.createStringTemplateInternally(proto);
831 setFirstArgument(scope, st, iterValue);
832 if ( st.impl.isAnonSubtemplate ) {
833 st.rawSetAttribute("i0", i0);
834 st.rawSetAttribute("i", i);
835 }
836 mapped.add(st);
837 i0++;
838 i++;
839 }
840 return mapped;
841 }
842
843 /**
844 * 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