]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/single/SingleSetListener.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db.common / src / org / simantics / db / common / procedure / single / SingleSetListener.java
index 7da48efa5eb216ef0c03e972333ae19128a731c1..54ed69a7471d6c9f8b48ca2b4879c365609d2fe9 100644 (file)
@@ -1,64 +1,64 @@
-/*******************************************************************************\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.Disposable;\r
-import org.simantics.db.procedure.Listener;\r
-import org.simantics.db.procedure.SetListener;\r
-\r
-abstract public class SingleSetListener<T> implements Listener<Collection<T>>, SetListener<T>, Disposable {\r
-       \r
-    private boolean disposed = false;\r
-       \r
-    private Collection<T> previous = null;\r
-    \r
-    public void add(T result) {};\r
-    public void remove(T result) {};\r
-    \r
-    @Override\r
-    public void execute(Collection<T> result) {\r
-       \r
-       if(result == null) result = new HashSet<T>();\r
-       \r
-        if(previous == null) {\r
-\r
-            for(T t : result) add(t);\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(t);\r
-            for(T t : removed) remove(t);\r
-\r
-        }\r
-\r
-        previous = result;\r
-        \r
-    }\r
-       \r
-    public void dispose() {\r
-        disposed = true;\r
-    }\r
-\r
-    @Override\r
-    public boolean isDisposed() {\r
-        return disposed;\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.Disposable;
+import org.simantics.db.procedure.Listener;
+import org.simantics.db.procedure.SetListener;
+
+abstract public class SingleSetListener<T> implements Listener<Collection<T>>, SetListener<T>, Disposable {
+       
+    private boolean disposed = false;
+       
+    private Collection<T> previous = null;
+    
+    public void add(T result) {};
+    public void remove(T result) {};
+    
+    @Override
+    public void execute(Collection<T> result) {
+       
+       if(result == null) result = new HashSet<T>();
+       
+        if(previous == null) {
+
+            for(T t : result) add(t);
+
+        } 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(t);
+            for(T t : removed) remove(t);
+
+        }
+
+        previous = result;
+        
+    }
+       
+    public void dispose() {
+        disposed = true;
+    }
+
+    @Override
+    public boolean isDisposed() {
+        return disposed;
+    }
+    
+}