@@ -0,0 +1,2635 @@
+package yokohama.unit.translator;%0D%0A%0D%0Aimport com.github.dakusui.jcunit.constraint.ConstraintManager;%0D%0Aimport com.github.dakusui.jcunit.constraint.constraintmanagers.NullConstraintManager;%0D%0Aimport com.github.dakusui.jcunit.core.Param;%0D%0Aimport com.github.dakusui.jcunit.core.factor.Factor;%0D%0Aimport com.github.dakusui.jcunit.core.factor.Factors;%0D%0Aimport com.github.dakusui.jcunit.generators.IPO2TupleGenerator;%0D%0Aimport com.github.dakusui.jcunit.generators.TupleGenerator;%0D%0Aimport java.util.HashMap;%0D%0Aimport java.util.List;%0D%0Aimport java.util.Map;%0D%0Aimport java.util.Set;%0D%0Aimport java.util.stream.Collectors;%0D%0Aimport java.util.stream.StreamSupport;%0D%0Aimport yokohama.unit.util.GenSym;%0D%0Aimport yokohama.unit.util.Pair;%0D%0A%0D%0Apublic class JCUnitIPO2CombinationStrategy implements CombinationStrategy %7B%0D%0A    public %3CK, V%3E List%3CList%3CPair%3CK, V%3E%3E%3E generate(List%3CPair%3CK, List%3CV%3E%3E%3E candidates) %7B%0D%0A        GenSym genSym = new GenSym();%0D%0A        Map%3CString, K%3E map = new HashMap%3C%3E();%0D%0A        Factors.Builder factorsBuilder = new Factors.Builder();%0D%0A        for (Pair%3CK, List%3CV%3E%3E candidate : candidates) %7B%0D%0A            K key = candidate.getFirst();%0D%0A            String sym = genSym.generate(key.toString()).getName();%0D%0A            map.put(sym, key);%0D%0A            Factor.Builder factorBuilder = new Factor.Builder();%0D%0A            factorBuilder.setName(sym);%0D%0A            for (V v : candidate.getSecond()) %7B%0D%0A                factorBuilder.addLevel(v);%0D%0A            %7D%0D%0A            Factor factor = factorBuilder.build();%0D%0A            factorsBuilder.add(factor);%0D%0A        %7D%0D%0A        Factors factors = factorsBuilder.build();%0D%0A        ConstraintManager cm = new NullConstraintManager();%0D%0A        TupleGenerator tg = new TupleGenerator.Builder()%0D%0A                .setTupleGeneratorClass(IPO2TupleGenerator.class)%0D%0A                .setConstraintManager(cm)%0D%0A                .setFactors(factors)%0D%0A                .setParameters(new Param%5B0%5D)%0D%0A                .build();%0D%0A        List%3CList%3CPair%3CK, V%3E%3E%3E tuples =%0D%0A                StreamSupport.stream(tg.spliterator(), false)%0D%0A                        .map(tuple -%3E %7B%0D%0A                            Set%3CString%3E keys = tuple.keySet();%0D%0A                            return keys.stream()%0D%0A                                    .map(key -%3E %7B%0D%0A                                        @SuppressWarnings(%22unchecked%22) V v =%0D%0A                                                (V)tuple.get(key);%0D%0A                                        return new Pair%3C%3E(map.get(key), v);%0D%0A                                    %7D).collect(Collectors.toList());%0D%0A                        %7D).collect(Collectors.toList());%0D%0A        return tuples;%0D%0A    %7D%0D%0A%7D%0D%0A

Add JCUnitIPO2CombinationStrategy