]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.graph.db/src/org/simantics/graph/db/TGStatusMonitor.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.graph.db / src / org / simantics / graph / db / TGStatusMonitor.java
index 8f93639eac225667401e242bd1e1e0b8993cc6ff..54d65ce98f307f2e6a4dd2a95f881837930295d5 100644 (file)
@@ -1,52 +1,52 @@
-package org.simantics.graph.db;\r
-\r
-public interface TGStatusMonitor {\r
-\r
-    void status(int percentage);\r
-    boolean isCanceled();\r
-\r
-    public static class NullMonitor implements TGStatusMonitor {\r
-        @Override\r
-        public void status(int percentage) {\r
-        }\r
-        @Override\r
-        public boolean isCanceled() {\r
-            return false;\r
-        }\r
-    }\r
-\r
-    public static final TGStatusMonitor NULL_MONITOR = new NullMonitor();\r
-\r
-    public static class Updater {\r
-        private final TGStatusMonitor monitor;\r
-        private final int total;\r
-        private int low;\r
-        private int high;\r
-        private int current;\r
-        private int worked;\r
-\r
-        public Updater(TGStatusMonitor monitor, int lowPercentage, int highPercentage, int totalWork) {\r
-            this.monitor = monitor;\r
-            this.low = lowPercentage;\r
-            this.high = highPercentage;\r
-            this.total = totalWork;\r
-        }\r
-\r
-        public int worked(int work) {\r
-            worked += work;\r
-            return current = updatePercentage(monitor, low, high, current, worked, total);\r
-        }\r
-    }\r
-\r
-    public static int updatePercentage(TGStatusMonitor monitor, int low, int high, int oldPercentage, int done, int total) {\r
-        int range = high - low;\r
-        int current = low + (range * done) / total;\r
-        if (current != oldPercentage) {\r
-            oldPercentage = current;\r
-            if (monitor != null) \r
-                monitor.status(oldPercentage);\r
-        }\r
-        return oldPercentage;\r
-    }\r
-\r
+package org.simantics.graph.db;
+
+public interface TGStatusMonitor {
+
+    void status(int percentage);
+    boolean isCanceled();
+
+    public static class NullMonitor implements TGStatusMonitor {
+        @Override
+        public void status(int percentage) {
+        }
+        @Override
+        public boolean isCanceled() {
+            return false;
+        }
+    }
+
+    public static final TGStatusMonitor NULL_MONITOR = new NullMonitor();
+
+    public static class Updater {
+        private final TGStatusMonitor monitor;
+        private final int total;
+        private int low;
+        private int high;
+        private int current;
+        private int worked;
+
+        public Updater(TGStatusMonitor monitor, int lowPercentage, int highPercentage, int totalWork) {
+            this.monitor = monitor;
+            this.low = lowPercentage;
+            this.high = highPercentage;
+            this.total = totalWork;
+        }
+
+        public int worked(int work) {
+            worked += work;
+            return current = updatePercentage(monitor, low, high, current, worked, total);
+        }
+    }
+
+    public static int updatePercentage(TGStatusMonitor monitor, int low, int high, int oldPercentage, int done, int total) {
+        int range = high - low;
+        int current = low + (range * done) / total;
+        if (current != oldPercentage) {
+            oldPercentage = current;
+            if (monitor != null) 
+                monitor.status(oldPercentage);
+        }
+        return oldPercentage;
+    }
+
 }
\ No newline at end of file