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

Method rot_map_iterator

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

Source from the content-addressed store, hash-verified

789 }
790
791 protected List<ST> rot_map_iterator(InstanceScope scope, Iterator<?> attr, List<ST> prototypes) {
792 List<ST> mapped = new ArrayList<ST>();
793 Iterator<?> iter = attr;
794 int i0 = 0;
795 int i = 1;
796 int ti = 0;
797 while ( iter.hasNext() ) {
798 Object iterValue = iter.next();
799 if ( iterValue==null ) {
800 mapped.add(null);
801 continue;
802 }
803
804 int templateIndex = ti% prototypes.size(); // rotate through
805 ti++;
806 ST proto = prototypes.get(templateIndex);
807 ST st = group.createStringTemplateInternally(proto);
808 setFirstArgument(scope, st, iterValue);
809 if ( st.impl.isAnonSubtemplate ) {
810 st.rawSetAttribute("i0", i0);
811 st.rawSetAttribute("i", i);
812 }
813 mapped.add(st);
814 i0++;
815 i++;
816 }
817 return mapped;
818 }
819
820 /**
821 * 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