more performant static map descriptors
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/util/ResourceMapper.java b/src/main/java/de/ids_mannheim/korap/query/serialize/util/ResourceMapper.java
index b55d9be..4288d1f 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/util/ResourceMapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/util/ResourceMapper.java
@@ -1,22 +1,27 @@
package de.ids_mannheim.korap.query.serialize.util;
import java.util.HashMap;
+import java.util.Map;
public class ResourceMapper {
- public static String descriptor2policy(String descriptor) {
- HashMap<String, String> map = new HashMap<String, String>();
- map.put("surface", "t");
- map.put("lemma", "l");
- map.put("pos", "p");
- map.put("const", "c");
- map.put("dep", "d");
- map.put("morph", "msd");
- if (map.containsKey(descriptor))
- return map.get(descriptor);
- else
- return descriptor;
- }
+ private static final Map<String, String> map = new HashMap<>();
+
+ static {
+ map.put("surface", "t");
+ map.put("lemma", "l");
+ map.put("pos", "p");
+ map.put("const", "c");
+ map.put("dep", "d");
+ map.put("morph", "msd");
+ }
+
+ public static String descriptor2policy(String descriptor) {
+ if (map.containsKey(descriptor))
+ return map.get(descriptor);
+ else
+ return descriptor;
+ }
}