1 package org.simantics.graph.compiler.internal.procedures;
3 import gnu.trove.map.hash.TIntIntHashMap;
5 import org.simantics.graph.store.GraphStore;
7 public class Compactify implements Runnable {
10 public Compactify(GraphStore store) {
16 // Mark all used resources
17 int resourceCount = store.identities.getResourceCount();
18 final boolean[] temp = new boolean[resourceCount];
19 store.collectReferences(temp);
22 int newResourceCount = 0;
23 TIntIntHashMap map = new TIntIntHashMap(resourceCount);
24 for(int i=0;i<resourceCount;++i)
26 map.put(i, newResourceCount++);
27 if(newResourceCount < resourceCount) {
29 store.identities.setResourceCount(newResourceCount);