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