--- /dev/null
+package org.simantics.graph.compiler.internal.store;\r
+\r
+import gnu.trove.map.hash.TIntIntHashMap;\r
+import gnu.trove.map.hash.TIntObjectHashMap;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
+import org.simantics.graph.store.IStore;\r
+import org.simantics.graph.store.IndexMappingUtils;\r
+import org.simantics.ltk.Location;\r
+\r
+public class LocationStore implements IStore {\r
+ \r
+ TIntObjectHashMap<Location> locations;\r
+\r
+ public LocationStore(TIntObjectHashMap<Location> locations) {\r
+ this.locations = locations;\r
+ }\r
+\r
+ public LocationStore() {\r
+ this(new TIntObjectHashMap<Location>());\r
+ }\r
+\r
+ @Override\r
+ public void map(TIntIntHashMap map) {\r
+ locations = IndexMappingUtils.map(map, locations, new TIntHashSet());\r
+ }\r
+ \r
+ public Location getLocation(int id) {\r
+ return locations.get(id);\r
+ }\r
+\r
+ public void add(int resource, Location tree) {\r
+ locations.putIfAbsent(resource, tree); \r
+ }\r
+\r
+}\r