-package org.simantics.graph.compiler.internal.procedures;\r
-\r
-import gnu.trove.map.hash.TIntIntHashMap;\r
-\r
-import org.simantics.graph.store.GraphStore;\r
-\r
-public class Compactify implements Runnable {\r
- GraphStore store;\r
-\r
- public Compactify(GraphStore store) {\r
- this.store = store;\r
- }\r
-\r
- @Override\r
- public void run() {\r
- // Mark all used resources\r
- int resourceCount = store.identities.getResourceCount();\r
- final boolean[] temp = new boolean[resourceCount];\r
- store.collectReferences(temp);\r
- \r
- // Create a map\r
- int newResourceCount = 0;\r
- TIntIntHashMap map = new TIntIntHashMap(resourceCount);\r
- for(int i=0;i<resourceCount;++i)\r
- if(temp[i])\r
- map.put(i, newResourceCount++);\r
- if(newResourceCount < resourceCount) {\r
- store.map(map);\r
- store.identities.setResourceCount(newResourceCount);\r
- }\r
- }\r
-}\r
+package org.simantics.graph.compiler.internal.procedures;
+
+import org.simantics.graph.store.GraphStore;
+
+import gnu.trove.map.hash.TIntIntHashMap;
+
+public class Compactify implements Runnable {
+ GraphStore store;
+
+ public Compactify(GraphStore store) {
+ this.store = store;
+ }
+
+ @Override
+ public void run() {
+ // Mark all used resources
+ int resourceCount = store.identities.getResourceCount();
+ final boolean[] temp = new boolean[resourceCount];
+ store.collectReferences(temp);
+
+ // Create a map
+ int newResourceCount = 0;
+ TIntIntHashMap map = new TIntIntHashMap(resourceCount);
+ for(int i=0;i<resourceCount;++i)
+ if(temp[i])
+ map.put(i, newResourceCount++);
+ if(newResourceCount < resourceCount) {
+ store.map(map);
+ store.identities.setResourceCount(newResourceCount);
+ }
+ }
+}