sequence mappings and DbRef mapping objects unified and source binding for castor...
[vamsas.git] / src / uk / ac / vamsas / objects / core / ApplicationData.java
index ff0b5d0..ea61bca 100644 (file)
@@ -165,40 +165,117 @@ implements java.io.Serializable
         if (obj instanceof ApplicationData) {
         
             ApplicationData temp = (ApplicationData)obj;
+            boolean thcycle;
+            boolean tmcycle;
             if (this._version != null) {
                 if (temp._version == null) return false;
-                else if (!(this._version.equals(temp._version))) 
-                    return false;
-            }
-            else if (temp._version != null)
+                if (this._version != temp._version) {
+                    thcycle=org.castor.util.CycleBreaker.startingToCycle(this._version);
+                    tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._version);
+                    if (thcycle!=tmcycle) {
+                        if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._version); };
+                        if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._version); };
+                        return false;
+                    }
+                    if (!thcycle) {
+                        if (!this._version.equals(temp._version)) {
+                            org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
+                            org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
+                            return false;
+                        }
+                        org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
+                        org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
+                    }
+                }
+            } else if (temp._version != null)
                 return false;
             if (this._name != null) {
                 if (temp._name == null) return false;
-                else if (!(this._name.equals(temp._name))) 
-                    return false;
-            }
-            else if (temp._name != null)
+                if (this._name != temp._name) {
+                    thcycle=org.castor.util.CycleBreaker.startingToCycle(this._name);
+                    tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._name);
+                    if (thcycle!=tmcycle) {
+                        if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._name); };
+                        if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._name); };
+                        return false;
+                    }
+                    if (!thcycle) {
+                        if (!this._name.equals(temp._name)) {
+                            org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
+                            org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
+                            return false;
+                        }
+                        org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
+                        org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
+                    }
+                }
+            } else if (temp._name != null)
                 return false;
             if (this._userList != null) {
                 if (temp._userList == null) return false;
-                else if (!(this._userList.equals(temp._userList))) 
-                    return false;
-            }
-            else if (temp._userList != null)
+                if (this._userList != temp._userList) {
+                    thcycle=org.castor.util.CycleBreaker.startingToCycle(this._userList);
+                    tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._userList);
+                    if (thcycle!=tmcycle) {
+                        if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._userList); };
+                        if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._userList); };
+                        return false;
+                    }
+                    if (!thcycle) {
+                        if (!this._userList.equals(temp._userList)) {
+                            org.castor.util.CycleBreaker.releaseCycleHandle(this._userList);
+                            org.castor.util.CycleBreaker.releaseCycleHandle(temp._userList);
+                            return false;
+                        }
+                        org.castor.util.CycleBreaker.releaseCycleHandle(this._userList);
+                        org.castor.util.CycleBreaker.releaseCycleHandle(temp._userList);
+                    }
+                }
+            } else if (temp._userList != null)
                 return false;
             if (this._common != null) {
                 if (temp._common == null) return false;
-                else if (!(this._common.equals(temp._common))) 
-                    return false;
-            }
-            else if (temp._common != null)
+                if (this._common != temp._common) {
+                    thcycle=org.castor.util.CycleBreaker.startingToCycle(this._common);
+                    tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._common);
+                    if (thcycle!=tmcycle) {
+                        if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._common); };
+                        if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._common); };
+                        return false;
+                    }
+                    if (!thcycle) {
+                        if (!this._common.equals(temp._common)) {
+                            org.castor.util.CycleBreaker.releaseCycleHandle(this._common);
+                            org.castor.util.CycleBreaker.releaseCycleHandle(temp._common);
+                            return false;
+                        }
+                        org.castor.util.CycleBreaker.releaseCycleHandle(this._common);
+                        org.castor.util.CycleBreaker.releaseCycleHandle(temp._common);
+                    }
+                }
+            } else if (temp._common != null)
                 return false;
             if (this._instanceList != null) {
                 if (temp._instanceList == null) return false;
-                else if (!(this._instanceList.equals(temp._instanceList))) 
-                    return false;
-            }
-            else if (temp._instanceList != null)
+                if (this._instanceList != temp._instanceList) {
+                    thcycle=org.castor.util.CycleBreaker.startingToCycle(this._instanceList);
+                    tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._instanceList);
+                    if (thcycle!=tmcycle) {
+                        if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._instanceList); };
+                        if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._instanceList); };
+                        return false;
+                    }
+                    if (!thcycle) {
+                        if (!this._instanceList.equals(temp._instanceList)) {
+                            org.castor.util.CycleBreaker.releaseCycleHandle(this._instanceList);
+                            org.castor.util.CycleBreaker.releaseCycleHandle(temp._instanceList);
+                            return false;
+                        }
+                        org.castor.util.CycleBreaker.releaseCycleHandle(this._instanceList);
+                        org.castor.util.CycleBreaker.releaseCycleHandle(temp._instanceList);
+                    }
+                }
+            } else if (temp._instanceList != null)
                 return false;
             return true;
         }
@@ -366,20 +443,30 @@ implements java.io.Serializable
         int result = super.hashCode();
         
         long tmp;
-        if (_version != null) {
+        if (_version != null
+            && !org.castor.util.CycleBreaker.startingToCycle(_version)) {
            result = 37 * result + _version.hashCode();
+           org.castor.util.CycleBreaker.releaseCycleHandle(_version);
         }
-        if (_name != null) {
+        if (_name != null
+            && !org.castor.util.CycleBreaker.startingToCycle(_name)) {
            result = 37 * result + _name.hashCode();
+           org.castor.util.CycleBreaker.releaseCycleHandle(_name);
         }
-        if (_userList != null) {
+        if (_userList != null
+            && !org.castor.util.CycleBreaker.startingToCycle(_userList)) {
            result = 37 * result + _userList.hashCode();
+           org.castor.util.CycleBreaker.releaseCycleHandle(_userList);
         }
-        if (_common != null) {
+        if (_common != null
+            && !org.castor.util.CycleBreaker.startingToCycle(_common)) {
            result = 37 * result + _common.hashCode();
+           org.castor.util.CycleBreaker.releaseCycleHandle(_common);
         }
-        if (_instanceList != null) {
+        if (_instanceList != null
+            && !org.castor.util.CycleBreaker.startingToCycle(_instanceList)) {
            result = 37 * result + _instanceList.hashCode();
+           org.castor.util.CycleBreaker.releaseCycleHandle(_instanceList);
         }
         
         return result;