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

Method rot_map_iterator

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

Source from the content-addressed store, hash-verified

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