]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterCollectorSupportImpl.java
Sync git svn branch with SVN repository r33308.
[simantics/platform.git] / bundles / org.simantics.db.procore / src / fi / vtt / simantics / procore / internal / ClusterCollectorSupportImpl.java
1 package fi.vtt.simantics.procore.internal;\r
2 \r
3 import org.simantics.db.service.ClusterCollectorPolicy;\r
4 import org.simantics.db.service.ClusterCollectorPolicy.CollectorCluster;\r
5 \r
6 class ClusterCollectorSupportImpl implements ClusterCollectorSupport {\r
7 \r
8         private final ClusterTable clusterTable;\r
9 \r
10         ClusterCollectorSupportImpl(ClusterTable clusterTable) {\r
11                 this.clusterTable = clusterTable;\r
12         }\r
13 \r
14         @Override\r
15         public void setPolicy(ClusterCollectorPolicy policy) {\r
16                 clusterTable.setCollectorPolicy(policy);\r
17         }\r
18         \r
19         @Override\r
20         public int getCurrentSize() {\r
21                 return (int)this.clusterTable.getSizeInBytes();\r
22         }\r
23         \r
24         @Override\r
25         public long getClusterSize(CollectorCluster id) {\r
26             return clusterTable.getClusterByClusterId(id.getClusterId()).getCachedSize();\r
27         }\r
28         \r
29         @Override\r
30         public Iterable<CollectorCluster> getResidentClusters() {\r
31                 return clusterTable.importanceMap.values();\r
32         }\r
33 \r
34         @Override\r
35         public void release(CollectorCluster id) {\r
36                 clusterTable.release(id);\r
37         }\r
38         \r
39 }