tech.molecules.leet.chem.CombinatoricsUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leet-chem-core Show documentation
Show all versions of leet-chem-core Show documentation
Cheminformatics and computational chemistry algorithms and workflows.
package tech.molecules.leet.chem;
import java.util.ArrayList;
import java.util.List;
public class CombinatoricsUtils {
public static List intSeq(int end) {
return intSeq(0,end,new ArrayList<>());
}
public static List intSeq(int end, List skip) {
return intSeq(0,end,skip);
}
public static List intSeq(int start, int end, List skip) {
List seq = new ArrayList<>();
for(int zi=start;zi> all_permutations(List li) {
if(li.size()==1) {
ArrayList> pi = new ArrayList<>();
pi.add( new ArrayList<>(li) );
return pi;
}
List> all_permutations = new ArrayList<>();
for(int zi=0;zi li2 = new ArrayList<>(li);
Integer xi = li2.get(zi);
li2.remove(zi);
List> perms = all_permutations(li2);
for(List pei : perms) {
pei.add(xi);
all_permutations.add(pei);
}
}
return all_permutations;
}
}