]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/store/LocationStore.java
Removed org.simantics.ltk[.antlr] bundles, exact import for antlr
[simantics/platform.git] / bundles / org.simantics.graph.compiler / src / org / simantics / graph / compiler / internal / store / LocationStore.java
1 package org.simantics.graph.compiler.internal.store;
2
3 import org.simantics.graph.compiler.internal.ltk.Location;
4 import org.simantics.graph.store.IStore;
5 import org.simantics.graph.store.IndexMappingUtils;
6
7 import gnu.trove.map.hash.TIntIntHashMap;
8 import gnu.trove.map.hash.TIntObjectHashMap;
9 import gnu.trove.set.hash.TIntHashSet;
10
11 public class LocationStore implements IStore {
12         
13         TIntObjectHashMap<Location> locations;
14
15         public LocationStore(TIntObjectHashMap<Location> locations) {
16                 this.locations = locations;
17         }
18
19         public LocationStore() {
20                 this(new TIntObjectHashMap<Location>());
21         }
22
23         @Override
24         public void map(TIntIntHashMap map) {
25                 locations = IndexMappingUtils.map(map, locations, new TIntHashSet());
26         }
27         
28         public Location getLocation(int id) {
29                 return locations.get(id);
30         }
31
32         public void add(int resource, Location tree) {
33                 locations.putIfAbsent(resource, tree);          
34         }
35
36 }