]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ListenerEntry.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / query / ListenerEntry.java
index 31621291a6c08f625579a459c399692cf18e12d8..9668c0d1dfc47af0ca57dec06d5e464ef5ec44c2 100644 (file)
@@ -1,76 +1,76 @@
-/*******************************************************************************\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.impl.query;\r
-\r
-import org.simantics.db.procedure.ListenerBase;\r
-\r
-class ListenerEntry {\r
-    \r
-    public static final Object NO_VALUE = new Object() {\r
-        \r
-        public String toString() { return "NO_VALUE"; };\r
-        \r
-    };\r
-    public static final Object NOT_CHANGED = new Object() {\r
-      \r
-        public String toString() { return "NOT_CHANGED"; };\r
-        \r
-    };\r
-    \r
-    public ListenerBase base;\r
-    public Object procedure;\r
-    public CacheEntry entry;\r
-    \r
-    private Object lastKnownResult;\r
-    \r
-    public ListenerEntry(CacheEntry entry, ListenerBase base, Object procedure) {\r
-        this.entry = entry;\r
-        this.base = base;\r
-        this.procedure = procedure;\r
-        if(entry.isReady()) {\r
-            this.lastKnownResult = entry.getResult();\r
-        } else {\r
-            this.lastKnownResult = NO_VALUE;\r
-        }\r
-    }\r
-    \r
-    public void setLastKnown(Object object) {\r
-       lastKnownResult = object;\r
-    }\r
-    \r
-    public Object getLastKnown() {\r
-       return lastKnownResult;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-//     return "[ListenerEntry last = " + lastKnownResult + ", procedure = " + procedure + "]";\r
-       return "[ListenerEntry " + ", procedure = " + procedure + " base=" + base + "]";\r
-    }\r
-    \r
-    @Override\r
-    public int hashCode() {\r
-        return base.hashCode();\r
-    }\r
-    \r
-       @Override\r
-    public boolean equals(Object obj) {\r
-\r
-        if(obj == this) return true;\r
-        if(obj == null) return false;\r
-        if(obj.getClass() != this.getClass()) return false;\r
-        ListenerEntry other = (ListenerEntry)obj;\r
-        return base.equals(other.base);\r
-        \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.impl.query;
+
+import org.simantics.db.procedure.ListenerBase;
+
+class ListenerEntry {
+    
+    public static final Object NO_VALUE = new Object() {
+        
+        public String toString() { return "NO_VALUE"; };
+        
+    };
+    public static final Object NOT_CHANGED = new Object() {
+      
+        public String toString() { return "NOT_CHANGED"; };
+        
+    };
+    
+    public ListenerBase base;
+    public Object procedure;
+    public CacheEntry entry;
+    
+    private Object lastKnownResult;
+    
+    public ListenerEntry(CacheEntry entry, ListenerBase base, Object procedure) {
+        this.entry = entry;
+        this.base = base;
+        this.procedure = procedure;
+        if(entry.isReady()) {
+            this.lastKnownResult = entry.getResult();
+        } else {
+            this.lastKnownResult = NO_VALUE;
+        }
+    }
+    
+    public void setLastKnown(Object object) {
+       lastKnownResult = object;
+    }
+    
+    public Object getLastKnown() {
+       return lastKnownResult;
+    }
+
+    @Override
+    public String toString() {
+//     return "[ListenerEntry last = " + lastKnownResult + ", procedure = " + procedure + "]";
+       return "[ListenerEntry " + ", procedure = " + procedure + " base=" + base + "]";
+    }
+    
+    @Override
+    public int hashCode() {
+        return base.hashCode();
+    }
+    
+       @Override
+    public boolean equals(Object obj) {
+
+        if(obj == this) return true;
+        if(obj == null) return false;
+        if(obj.getClass() != this.getClass()) return false;
+        ListenerEntry other = (ListenerEntry)obj;
+        return base.equals(other.base);
+        
+    }
+    
+}