* cache compiled patterns

This commit is contained in:
Reinhard Pointner 2013-12-14 04:11:44 +00:00
parent 0c3406f0b0
commit 59138a3581
1 changed files with 12 additions and 7 deletions

View File

@ -193,7 +193,7 @@ public class ReleaseInfo {
} }
} }
} }
volumeRoots = volumes; volumeRoots = unmodifiableSet(volumes);
} }
return volumeRoots; return volumeRoots;
} }
@ -271,7 +271,10 @@ public class ReleaseInfo {
return anidbIndexResource.get(); return anidbIndexResource.get();
} }
private Map<Pattern, String> seriesDirectMappings;
public Map<Pattern, String> getSeriesDirectMappings() throws IOException { public Map<Pattern, String> getSeriesDirectMappings() throws IOException {
if (seriesDirectMappings == null) {
Map<Pattern, String> mappings = new LinkedHashMap<Pattern, String>(); Map<Pattern, String> mappings = new LinkedHashMap<Pattern, String>();
for (String line : seriesDirectMappingsResource.get()) { for (String line : seriesDirectMappingsResource.get()) {
String[] tsv = line.split("\t", 2); String[] tsv = line.split("\t", 2);
@ -279,7 +282,9 @@ public class ReleaseInfo {
mappings.put(compile("(?<!\\p{Alnum})(" + tsv[0] + ")(?!\\p{Alnum})", CASE_INSENSITIVE | UNICODE_CASE), tsv[1]); mappings.put(compile("(?<!\\p{Alnum})(" + tsv[0] + ")(?!\\p{Alnum})", CASE_INSENSITIVE | UNICODE_CASE), tsv[1]);
} }
} }
return mappings; seriesDirectMappings = unmodifiableMap(mappings);
}
return seriesDirectMappings;
} }
public FileFilter getDiskFolderFilter() { public FileFilter getDiskFolderFilter() {