sequence mappings and DbRef mapping objects unified and source binding for castor...
[vamsas.git] / src / uk / ac / vamsas / objects / core / AppData.java
index 90235c3..d54bca7 100644 (file)
@@ -74,26 +74,73 @@ implements java.io.Serializable
         if (obj instanceof AppData) {\r
         \r
             AppData temp = (AppData)obj;\r
+            boolean thcycle;\r
+            boolean tmcycle;\r
             if (this._choiceValue != null) {\r
                 if (temp._choiceValue == null) return false;\r
-                else if (!(this._choiceValue.equals(temp._choiceValue))) \r
-                    return false;\r
-            }\r
-            else if (temp._choiceValue != null)\r
+                if (this._choiceValue != temp._choiceValue) {\r
+                    thcycle=org.castor.util.CycleBreaker.startingToCycle(this._choiceValue);\r
+                    tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._choiceValue);\r
+                    if (thcycle!=tmcycle) {\r
+                        if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._choiceValue); };\r
+                        if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._choiceValue); };\r
+                        return false;\r
+                    }\r
+                    if (!thcycle) {\r
+                        if (!this._choiceValue.equals(temp._choiceValue)) {\r
+                            org.castor.util.CycleBreaker.releaseCycleHandle(this._choiceValue);\r
+                            org.castor.util.CycleBreaker.releaseCycleHandle(temp._choiceValue);\r
+                            return false;\r
+                        }\r
+                        org.castor.util.CycleBreaker.releaseCycleHandle(this._choiceValue);\r
+                        org.castor.util.CycleBreaker.releaseCycleHandle(temp._choiceValue);\r
+                    }\r
+                }\r
+            } else if (temp._choiceValue != null)\r
                 return false;\r
             if (this._data != null) {\r
                 if (temp._data == null) return false;\r
-                else if (!(java.util.Arrays.equals(this._data, temp._data))) \r
-                    return false;\r
-            }\r
-            else if (temp._data != null)\r
+                if (this._data != temp._data) {\r
+                    thcycle=org.castor.util.CycleBreaker.startingToCycle(this._data);\r
+                    tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._data);\r
+                    if (thcycle!=tmcycle) {\r
+                        if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._data); };\r
+                        if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._data); };\r
+                        return false;\r
+                    }\r
+                    if (!thcycle) {\r
+                        if (!java.util.Arrays.equals(this._data, temp._data)) {\r
+                            org.castor.util.CycleBreaker.releaseCycleHandle(this._data);\r
+                            org.castor.util.CycleBreaker.releaseCycleHandle(temp._data);\r
+                            return false;\r
+                        }\r
+                        org.castor.util.CycleBreaker.releaseCycleHandle(this._data);\r
+                        org.castor.util.CycleBreaker.releaseCycleHandle(temp._data);\r
+                    }\r
+                }\r
+            } else if (temp._data != null)\r
                 return false;\r
             if (this._dataReference != null) {\r
                 if (temp._dataReference == null) return false;\r
-                else if (!(this._dataReference.equals(temp._dataReference))) \r
-                    return false;\r
-            }\r
-            else if (temp._dataReference != null)\r
+                if (this._dataReference != temp._dataReference) {\r
+                    thcycle=org.castor.util.CycleBreaker.startingToCycle(this._dataReference);\r
+                    tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._dataReference);\r
+                    if (thcycle!=tmcycle) {\r
+                        if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._dataReference); };\r
+                        if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataReference); };\r
+                        return false;\r
+                    }\r
+                    if (!thcycle) {\r
+                        if (!this._dataReference.equals(temp._dataReference)) {\r
+                            org.castor.util.CycleBreaker.releaseCycleHandle(this._dataReference);\r
+                            org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataReference);\r
+                            return false;\r
+                        }\r
+                        org.castor.util.CycleBreaker.releaseCycleHandle(this._dataReference);\r
+                        org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataReference);\r
+                    }\r
+                }\r
+            } else if (temp._dataReference != null)\r
                 return false;\r
             return true;\r
         }\r
@@ -145,14 +192,20 @@ implements java.io.Serializable
         int result = super.hashCode();\r
         \r
         long tmp;\r
-        if (_choiceValue != null) {\r
+        if (_choiceValue != null\r
+            && !org.castor.util.CycleBreaker.startingToCycle(_choiceValue)) {\r
            result = 37 * result + _choiceValue.hashCode();\r
+           org.castor.util.CycleBreaker.releaseCycleHandle(_choiceValue);\r
         }\r
-        if (_data != null) {\r
+        if (_data != null\r
+            && !org.castor.util.CycleBreaker.startingToCycle(_data)) {\r
            result = 37 * result + _data.hashCode();\r
+           org.castor.util.CycleBreaker.releaseCycleHandle(_data);\r
         }\r
-        if (_dataReference != null) {\r
+        if (_dataReference != null\r
+            && !org.castor.util.CycleBreaker.startingToCycle(_dataReference)) {\r
            result = 37 * result + _dataReference.hashCode();\r
+           org.castor.util.CycleBreaker.releaseCycleHandle(_dataReference);\r
         }\r
         \r
         return result;\r