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

Method rot_map_iterator

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

Source from the content-addressed store, hash-verified

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