]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterCollectorSupportImpl.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db.procore / src / fi / vtt / simantics / procore / internal / ClusterCollectorSupportImpl.java
diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterCollectorSupportImpl.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterCollectorSupportImpl.java
new file mode 100644 (file)
index 0000000..3c6d0ea
--- /dev/null
@@ -0,0 +1,39 @@
+package fi.vtt.simantics.procore.internal;\r
+\r
+import org.simantics.db.service.ClusterCollectorPolicy;\r
+import org.simantics.db.service.ClusterCollectorPolicy.CollectorCluster;\r
+\r
+class ClusterCollectorSupportImpl implements ClusterCollectorSupport {\r
+\r
+       private final ClusterTable clusterTable;\r
+\r
+       ClusterCollectorSupportImpl(ClusterTable clusterTable) {\r
+               this.clusterTable = clusterTable;\r
+       }\r
+\r
+       @Override\r
+       public void setPolicy(ClusterCollectorPolicy policy) {\r
+               clusterTable.setCollectorPolicy(policy);\r
+       }\r
+       \r
+       @Override\r
+       public int getCurrentSize() {\r
+               return (int)this.clusterTable.getSizeInBytes();\r
+       }\r
+       \r
+       @Override\r
+       public long getClusterSize(CollectorCluster id) {\r
+           return clusterTable.getClusterByClusterId(id.getClusterId()).getCachedSize();\r
+       }\r
+       \r
+       @Override\r
+       public Iterable<CollectorCluster> getResidentClusters() {\r
+               return clusterTable.importanceMap.values();\r
+       }\r
+\r
+       @Override\r
+       public void release(CollectorCluster id) {\r
+               clusterTable.release(id);\r
+       }\r
+       \r
+}
\ No newline at end of file