Merge branch 'master' into private/eclipse-4.7
[simantics/platform.git] / bundles / org.simantics.db.procore / src / fi / vtt / simantics / procore / internal / ClusterChangeManager.java
index 9f203c8af5a1402853fa10593fcaeb5049a1001d..83088135559fe16603c060a13325436b6e3fbd34 100644 (file)
@@ -1,65 +1,65 @@
-package fi.vtt.simantics.procore.internal;\r
-\r
-import gnu.trove.set.hash.THashSet;\r
-\r
-import java.util.Collection;\r
-import java.util.LinkedList;\r
-\r
-public class ClusterChangeManager {\r
-    \r
-    final private THashSet<ClusterChange> clusterChanges = new THashSet<ClusterChange>();\r
-    final private LinkedList<ClusterChange> removeList = new LinkedList<ClusterChange>();\r
-    private int changeCounter = 0;\r
-    private int byteLimit = 65536;\r
-    \r
-    public void checkFlush() {\r
-        if(changeCounter < 50) return;\r
-        ClusterChange test = removeList.poll();\r
-        if(test == null) return;\r
-        if(test.byteIndex > byteLimit) {\r
-            test.flushCollect(null);\r
-        } else {\r
-            removeList.add(test);\r
-        }\r
-    }\r
-    \r
-    public void updateChangeCounters() {\r
-        changeCounter = clusterChanges.size();\r
-        byteLimit = (100-changeCounter)*ClusterChange.MAX_FIXED_BYTES;\r
-    }\r
-\r
-    void addChange(ClusterChange change) {\r
-        clusterChanges.add(change);\r
-        updateChangeCounters();\r
-    }\r
-\r
-    Collection<ClusterChange> get() {\r
-        return clusterChanges;\r
-    }\r
-    \r
-    void add(ClusterChange change) {\r
-        if(clusterChanges.add(change)) {\r
-            removeList.add(change);\r
-        } else {\r
-            new Exception("trying to add change that already exists").printStackTrace();\r
-        }\r
-        updateChangeCounters();\r
-    }\r
-    \r
-    void remove(Collection<ClusterChange> changes) {\r
-        clusterChanges.removeAll(changes);\r
-        removeList.removeAll(changes);\r
-        updateChangeCounters();\r
-    }\r
-    \r
-    int size() {\r
-        return clusterChanges.size();\r
-    }\r
-    \r
-    void clear() {\r
-        clusterChanges.clear();\r
-        removeList.clear();\r
-        updateChangeCounters();\r
-    }\r
-    \r
-}\r
+package fi.vtt.simantics.procore.internal;
+
+import gnu.trove.set.hash.THashSet;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+public class ClusterChangeManager {
+    
+    final private THashSet<ClusterChange> clusterChanges = new THashSet<ClusterChange>();
+    final private LinkedList<ClusterChange> removeList = new LinkedList<ClusterChange>();
+    private int changeCounter = 0;
+    private int byteLimit = 65536;
+    
+    public void checkFlush() {
+        if(changeCounter < 50) return;
+        ClusterChange test = removeList.poll();
+        if(test == null) return;
+        if(test.byteIndex > byteLimit) {
+            test.flushCollect(null);
+        } else {
+            removeList.add(test);
+        }
+    }
+    
+    public void updateChangeCounters() {
+        changeCounter = clusterChanges.size();
+        byteLimit = (100-changeCounter)*ClusterChange.MAX_FIXED_BYTES;
+    }
+
+    void addChange(ClusterChange change) {
+        clusterChanges.add(change);
+        updateChangeCounters();
+    }
+
+    Collection<ClusterChange> get() {
+        return clusterChanges;
+    }
+    
+    void add(ClusterChange change) {
+        if(clusterChanges.add(change)) {
+            removeList.add(change);
+        } else {
+            new Exception("trying to add change that already exists").printStackTrace();
+        }
+        updateChangeCounters();
+    }
+    
+    void remove(Collection<ClusterChange> changes) {
+        clusterChanges.removeAll(changes);
+        removeList.removeAll(changes);
+        updateChangeCounters();
+    }
+    
+    int size() {
+        return clusterChanges.size();
+    }
+    
+    void clear() {
+        clusterChanges.clear();
+        removeList.clear();
+        updateChangeCounters();
+    }
+    
+}