]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.common/src/org/simantics/db/common/StandardStatement.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.db.common / src / org / simantics / db / common / StandardStatement.java
index 6886faa1968157ffea9e02a567432e928c2e3577..7c7150eb537a19f36dfdab94bf703c9079e7e6db 100644 (file)
@@ -1,77 +1,77 @@
-/*******************************************************************************\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;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Statement;\r
-\r
-public final class StandardStatement implements Statement, Comparable<Statement> {\r
-       \r
-    final private Resource s;\r
-    final private Resource p;\r
-    final private Resource o;\r
-    \r
-    public StandardStatement(final Resource s, final Resource p, final Resource o) {\r
-        this.s = s;\r
-        this.p = p;\r
-        this.o = o;\r
-    }\r
-    \r
-    @Override\r
-    public Resource getObject() {\r
-        return o;\r
-    }\r
-\r
-    @Override\r
-    final public Resource getPredicate() {\r
-        return p;\r
-    }\r
-\r
-    @Override\r
-    final public Resource getSubject() {\r
-        return s;\r
-    }\r
-\r
-    @Override\r
-    public boolean isAsserted(Resource testSubject) {\r
-       return !s.equals(testSubject);\r
-    }\r
-    \r
-    @Override\r
-    final public int hashCode() {\r
-        return 41 * ( 31 * s.hashCode() + p.hashCode()) + o.hashCode();\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object object) {\r
-        if (this == object)\r
-            return true;\r
-        else if (object == null)\r
-            return false;\r
-        else if (!(object instanceof Statement))\r
-            return false;\r
-        Statement r = (Statement)object;\r
-        return s.equalsResource(r.getSubject()) && p.equalsResource(r.getPredicate()) && o.equalsResource(r.getObject());\r
-    }\r
-    \r
-    @Override\r
-    public int compareTo(Statement other) {\r
-        Statement impl = (Statement)other; \r
-        int result = s.compareTo(impl.getSubject());\r
-        if(result != 0) return result;\r
-        result = p.compareTo(impl.getPredicate());\r
-        if(result != 0) return result;\r
-        return o.compareTo(impl.getObject());\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.common;
+
+import org.simantics.db.Resource;
+import org.simantics.db.Statement;
+
+public final class StandardStatement implements Statement, Comparable<Statement> {
+       
+    final private Resource s;
+    final private Resource p;
+    final private Resource o;
+    
+    public StandardStatement(final Resource s, final Resource p, final Resource o) {
+        this.s = s;
+        this.p = p;
+        this.o = o;
+    }
+    
+    @Override
+    public Resource getObject() {
+        return o;
+    }
+
+    @Override
+    final public Resource getPredicate() {
+        return p;
+    }
+
+    @Override
+    final public Resource getSubject() {
+        return s;
+    }
+
+    @Override
+    public boolean isAsserted(Resource testSubject) {
+       return !s.equals(testSubject);
+    }
+    
+    @Override
+    final public int hashCode() {
+        return 41 * ( 31 * s.hashCode() + p.hashCode()) + o.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        if (this == object)
+            return true;
+        else if (object == null)
+            return false;
+        else if (!(object instanceof Statement))
+            return false;
+        Statement r = (Statement)object;
+        return s.equalsResource(r.getSubject()) && p.equalsResource(r.getPredicate()) && o.equalsResource(r.getObject());
+    }
+    
+    @Override
+    public int compareTo(Statement other) {
+        Statement impl = (Statement)other; 
+        int result = s.compareTo(impl.getSubject());
+        if(result != 0) return result;
+        result = p.compareTo(impl.getPredicate());
+        if(result != 0) return result;
+        return o.compareTo(impl.getObject());
+    }
+
+}
+