X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fuk%2Fac%2Fvamsas%2Fobjects%2Fcore%2FReferenceType.java;h=6c06137afe466fa1b6e22789c7cc4e12d8cd0bea;hb=f5306591821b5f6d4e381ff30b647bd149d51f43;hp=d25aea98d9426d61f81dcca293a57ec49684b88d;hpb=eae55a9d436c058b8f03036faa0a4baa930c2cd5;p=vamsas.git diff --git a/src/uk/ac/vamsas/objects/core/ReferenceType.java b/src/uk/ac/vamsas/objects/core/ReferenceType.java index d25aea9..6c06137 100644 --- a/src/uk/ac/vamsas/objects/core/ReferenceType.java +++ b/src/uk/ac/vamsas/objects/core/ReferenceType.java @@ -16,7 +16,6 @@ import org.exolab.castor.xml.Unmarshaller; /** * base type for citing arbitrary links between vamsas objects - * * Optional human readable description of the relationship * * @@ -37,12 +36,14 @@ implements java.io.Serializable private java.lang.String _content = ""; /** - * Primary Key for vamsas object referencing + * Primary Key for vamsas object referencing + * */ private java.lang.String _id; /** - * List of one or more vamsas object references + * List of one or more vamsas object + * references */ private java.util.Vector _refs; @@ -117,26 +118,73 @@ implements java.io.Serializable if (obj instanceof ReferenceType) { ReferenceType temp = (ReferenceType)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; if (this._id != null) { if (temp._id == null) return false; - else if (!(this._id.equals(temp._id))) - return false; - } - else if (temp._id != null) + if (this._id != temp._id) { + thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id); + tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id); + if (thcycle!=tmcycle) { + if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); }; + if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); }; + return false; + } + if (!thcycle) { + if (!this._id.equals(temp._id)) { + org.castor.util.CycleBreaker.releaseCycleHandle(this._id); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); + return false; + } + org.castor.util.CycleBreaker.releaseCycleHandle(this._id); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); + } + } + } else if (temp._id != null) return false; if (this._refs != null) { if (temp._refs == null) return false; - else if (!(this._refs.equals(temp._refs))) - return false; - } - else if (temp._refs != null) + if (this._refs != temp._refs) { + thcycle=org.castor.util.CycleBreaker.startingToCycle(this._refs); + tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._refs); + if (thcycle!=tmcycle) { + if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._refs); }; + if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._refs); }; + return false; + } + if (!thcycle) { + if (!this._refs.equals(temp._refs)) { + org.castor.util.CycleBreaker.releaseCycleHandle(this._refs); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._refs); + return false; + } + org.castor.util.CycleBreaker.releaseCycleHandle(this._refs); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._refs); + } + } + } else if (temp._refs != null) return false; return true; } @@ -157,7 +205,8 @@ implements java.io.Serializable /** * Returns the value of field 'id'. The field 'id' has the * following description: Primary Key for vamsas object - * referencing + * referencing + * * * @return the value of field 'Id'. */ @@ -235,14 +284,20 @@ 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); } - if (_id != null) { + if (_id != null + && !org.castor.util.CycleBreaker.startingToCycle(_id)) { result = 37 * result + _id.hashCode(); + org.castor.util.CycleBreaker.releaseCycleHandle(_id); } - if (_refs != null) { + if (_refs != null + && !org.castor.util.CycleBreaker.startingToCycle(_refs)) { result = 37 * result + _refs.hashCode(); + org.castor.util.CycleBreaker.releaseCycleHandle(_refs); } return result; @@ -340,7 +395,8 @@ implements java.io.Serializable /** * Sets the value of field 'id'. The field 'id' has the * following description: Primary Key for vamsas object - * referencing + * referencing + * * * @param id the value of field 'id'. */