]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/single/StagedSingleSetSyncListener.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db.common / src / org / simantics / db / common / procedure / single / StagedSingleSetSyncListener.java
index 92331eedc54227083b5770d75c4926c738cc35b4..c9a5ccef3934daad17ab0a181e37ac3305a892bc 100644 (file)
@@ -1,58 +1,58 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.db.common.procedure.single;\r
-\r
-import java.util.Collection;\r
-import java.util.HashSet;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.common.utils.Logger;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.procedure.SyncListener;\r
-\r
-abstract public class StagedSingleSetSyncListener<T> implements SyncListener<Collection<T>>{\r
-    \r
-    private Collection<T> previous = null;\r
-    \r
-    public void start(ReadGraph graph, Collection<T> items) throws DatabaseException {}\r
-    public void add(ReadGraph graph, T item) throws DatabaseException {}\r
-    public void remove(ReadGraph graph, T item) throws DatabaseException {}\r
-    \r
-    @Override\r
-    public synchronized void execute(ReadGraph graph, final Collection<T> result) throws DatabaseException {\r
-       \r
-        if(previous == null) {\r
-\r
-            start(graph, result);\r
-\r
-        } else {\r
-\r
-            HashSet<T> added = new HashSet<T>(result);\r
-            added.removeAll(previous);\r
-            HashSet<T> removed = new HashSet<T>(previous);\r
-            removed.removeAll(result);\r
-\r
-            for(T t : added) add(graph, t);\r
-            for(T t : removed) remove(graph, t);\r
-\r
-        }\r
-\r
-        previous = result;\r
-        \r
-    }\r
-    \r
-    @Override\r
-    public void exception(ReadGraph graph, Throwable throwable) throws DatabaseException {\r
-               Logger.defaultLogError(throwable);\r
-    }\r
-    \r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.db.common.procedure.single;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.simantics.db.ReadGraph;
+import org.simantics.db.common.utils.Logger;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.procedure.SyncListener;
+
+abstract public class StagedSingleSetSyncListener<T> implements SyncListener<Collection<T>>{
+    
+    private Collection<T> previous = null;
+    
+    public void start(ReadGraph graph, Collection<T> items) throws DatabaseException {}
+    public void add(ReadGraph graph, T item) throws DatabaseException {}
+    public void remove(ReadGraph graph, T item) throws DatabaseException {}
+    
+    @Override
+    public synchronized void execute(ReadGraph graph, final Collection<T> result) throws DatabaseException {
+       
+        if(previous == null) {
+
+            start(graph, result);
+
+        } else {
+
+            HashSet<T> added = new HashSet<T>(result);
+            added.removeAll(previous);
+            HashSet<T> removed = new HashSet<T>(previous);
+            removed.removeAll(result);
+
+            for(T t : added) add(graph, t);
+            for(T t : removed) remove(graph, t);
+
+        }
+
+        previous = result;
+        
+    }
+    
+    @Override
+    public void exception(ReadGraph graph, Throwable throwable) throws DatabaseException {
+               Logger.defaultLogError(throwable);
+    }
+    
+}