static List<MethodDecl> getMethodDecls(int startPos, int len, boolean last) { Column[] _cols = new Column[len]; List<Column[]> results = new ArrayList<Column[]>(); for (int i = 0; i < types.length; i++) { getColumns(results, _cols, 0, startPos, i); } List<MethodDecl> decls = new ArrayList<MethodDecl>(); for (Column[] cols : results) { MethodDecl md = new MethodDecl(cols, last); decls.add(md); } return decls; }
static void getColumns(List<Column[]> results, Column[] cols, int pos, int startPos, int type) { ColumnDecl cd = new ColumnDecl(types[type], "col" + (pos + startPos)); cd.setPos(startPos + pos); cols[pos] = new Column(cd); if (cols.length == pos + 1) { Column[] copied = Arrays.copyOf(cols, cols.length); results.add(copied); return; } for (int i = 0; i < types.length; i++) { getColumns(results, cols, pos + 1, startPos, i); } }