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

Method rot_map_iterator

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

Source from the content-addressed store, hash-verified

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