X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fuk%2Fac%2Fvamsas%2Fobjects%2Fcore%2FAttachment.java;h=b7c741f7a24f8d4bc101d44bacfe6c601f87fcbf;hb=4aeaba257ad7e3206158565b356da7e4b15bf0a2;hp=7b6fcc4971a9e79236eb06355b361ce2c3c678fe;hpb=ac12127b5cf22bb34b6042e543d506894164a94c;p=vamsas.git diff --git a/src/uk/ac/vamsas/objects/core/Attachment.java b/src/uk/ac/vamsas/objects/core/Attachment.java index 7b6fcc4..b7c741f 100644 --- a/src/uk/ac/vamsas/objects/core/Attachment.java +++ b/src/uk/ac/vamsas/objects/core/Attachment.java @@ -95,30 +95,77 @@ implements java.io.Serializable if (obj instanceof Attachment) { Attachment temp = (Attachment)obj; + boolean thcycle; + boolean tmcycle; if (this._compressed != temp._compressed) return false; if (this._has_compressed != temp._has_compressed) return false; if (this._type != null) { if (temp._type == null) return false; - else if (!(this._type.equals(temp._type))) - return false; - } - else if (temp._type != null) + if (this._type != temp._type) { + thcycle=org.castor.util.CycleBreaker.startingToCycle(this._type); + tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._type); + if (thcycle!=tmcycle) { + if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._type); }; + if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._type); }; + return false; + } + if (!thcycle) { + if (!this._type.equals(temp._type)) { + org.castor.util.CycleBreaker.releaseCycleHandle(this._type); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._type); + return false; + } + org.castor.util.CycleBreaker.releaseCycleHandle(this._type); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._type); + } + } + } else if (temp._type != null) return false; if (this._objectref != null) { if (temp._objectref == null) return false; - else if (!(this._objectref.equals(temp._objectref))) - return false; - } - else if (temp._objectref != null) + if (this._objectref != temp._objectref) { + thcycle=org.castor.util.CycleBreaker.startingToCycle(this._objectref); + tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._objectref); + if (thcycle!=tmcycle) { + if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._objectref); }; + if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._objectref); }; + return false; + } + if (!thcycle) { + if (!this._objectref.equals(temp._objectref)) { + org.castor.util.CycleBreaker.releaseCycleHandle(this._objectref); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._objectref); + return false; + } + org.castor.util.CycleBreaker.releaseCycleHandle(this._objectref); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._objectref); + } + } + } else if (temp._objectref != 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; return true; } @@ -201,14 +248,20 @@ implements java.io.Serializable long tmp; result = 37 * result + (_compressed?0:1); - if (_type != null) { + if (_type != null + && !org.castor.util.CycleBreaker.startingToCycle(_type)) { result = 37 * result + _type.hashCode(); + org.castor.util.CycleBreaker.releaseCycleHandle(_type); } - if (_objectref != null) { + if (_objectref != null + && !org.castor.util.CycleBreaker.startingToCycle(_objectref)) { result = 37 * result + _objectref.hashCode(); + org.castor.util.CycleBreaker.releaseCycleHandle(_objectref); } - if (_id != null) { + if (_id != null + && !org.castor.util.CycleBreaker.startingToCycle(_id)) { result = 37 * result + _id.hashCode(); + org.castor.util.CycleBreaker.releaseCycleHandle(_id); } return result;