1 package org.simantics.graph.compiler.internal.store;
3 import gnu.trove.map.hash.TIntIntHashMap;
4 import gnu.trove.map.hash.TIntObjectHashMap;
5 import gnu.trove.set.hash.TIntHashSet;
7 import org.simantics.graph.store.IStore;
8 import org.simantics.graph.store.IndexMappingUtils;
9 import org.simantics.ltk.Location;
11 public class LocationStore implements IStore {
13 TIntObjectHashMap<Location> locations;
15 public LocationStore(TIntObjectHashMap<Location> locations) {
16 this.locations = locations;
19 public LocationStore() {
20 this(new TIntObjectHashMap<Location>());
24 public void map(TIntIntHashMap map) {
25 locations = IndexMappingUtils.map(map, locations, new TIntHashSet());
28 public Location getLocation(int id) {
29 return locations.get(id);
32 public void add(int resource, Location tree) {
33 locations.putIfAbsent(resource, tree);