sequence mappings and DbRef mapping objects unified and source binding for castor...
[vamsas.git] / src / uk / ac / vamsas / objects / core / LockFile.java
index 915bd07..cb41ef9 100644 (file)
@@ -65,12 +65,29 @@ implements java.io.Serializable
         if (obj instanceof LockFile) {
         
             LockFile temp = (LockFile)obj;
+            boolean thcycle;
+            boolean tmcycle;
             if (this._content != null) {
                 if (temp._content == null) return false;
-                else if (!(this._content.equals(temp._content))) 
-                    return false;
-            }
-            else if (temp._content != null)
+                if (this._content != temp._content) {
+                    thcycle=org.castor.util.CycleBreaker.startingToCycle(this._content);
+                    tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._content);
+                    if (thcycle!=tmcycle) {
+                        if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._content); };
+                        if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._content); };
+                        return false;
+                    }
+                    if (!thcycle) {
+                        if (!this._content.equals(temp._content)) {
+                            org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
+                            org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
+                            return false;
+                        }
+                        org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
+                        org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
+                    }
+                }
+            } else if (temp._content != null)
                 return false;
             return true;
         }
@@ -101,8 +118,10 @@ implements java.io.Serializable
         int result = super.hashCode();
         
         long tmp;
-        if (_content != null) {
+        if (_content != null
+            && !org.castor.util.CycleBreaker.startingToCycle(_content)) {
            result = 37 * result + _content.hashCode();
+           org.castor.util.CycleBreaker.releaseCycleHandle(_content);
         }
         
         return result;