| 17 | } |
| 18 | |
| 19 | static ArrayList<Callable< Map<String, knucleotide> > > createFragmentTasks(final String sequence, int[] fragmentLengths) { |
| 20 | ArrayList<Callable<Map<String, knucleotide>>> tasks = new ArrayList<Callable<Map<String, knucleotide>>>(); |
| 21 | for (int fragmentLength : fragmentLengths) { |
| 22 | for (int index=0; index<fragmentLength; index++) { |
| 23 | final int offset = index; |
| 24 | final int finalFragmentLength = fragmentLength; |
| 25 | tasks.add(new Callable<Map<String, knucleotide>>() { |
| 26 | public Map<String, knucleotide> call() { |
| 27 | return createFragmentMap(sequence, offset, finalFragmentLength); |
| 28 | } |
| 29 | }); |
| 30 | } |
| 31 | } |
| 32 | return tasks; |
| 33 | } |
| 34 | |
| 35 | static Map<String, knucleotide> createFragmentMap(String sequence, int offset, int fragmentLength) { |
| 36 | HashMap<String, knucleotide> map = new HashMap<String, knucleotide>(); |