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