MCPcopy Index your code
hub / github.com/apache/groovy / createFragmentMap

Method createFragmentMap

benchmark/bench/knucleotide.java:35–48  ·  view source on GitHub ↗
(String sequence, int offset, int fragmentLength)

Source from the content-addressed store, hash-verified

33 }
34
35 static Map<String, knucleotide> createFragmentMap(String sequence, int offset, int fragmentLength) {
36 HashMap<String, knucleotide> map = new HashMap<String, knucleotide>();
37 int lastIndex = sequence.length() - fragmentLength + 1;
38 for (int index=offset; index<lastIndex; index+=fragmentLength) {
39 String temp = sequence.substring(index, index + fragmentLength);
40 knucleotide fragment = (knucleotide)map.get(temp);
41 if (fragment != null)
42 fragment.count++;
43 else
44 map.put(temp, new knucleotide(temp));
45 }
46
47 return map;
48 }
49
50 // Destructive!
51 static Map<String, knucleotide> sumTwoMaps(Map<String, knucleotide> map1, Map<String, knucleotide> map2) {

Callers 1

callMethod · 0.95

Calls 4

substringMethod · 0.80
getMethod · 0.65
putMethod · 0.65
lengthMethod · 0.45

Tested by

no test coverage detected