X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fuk%2Fac%2Fvamsas%2Fobjects%2Fcore%2FAlignmentAnnotation.java;h=b6c544c39c509329074563c447351badc2e42880;hb=3cc3232011f3d32d0e2553efb3a307fc29e337f7;hp=0ffea1208690b8fc11f3874164cef69ac0952f98;hpb=eae55a9d436c058b8f03036faa0a4baa930c2cd5;p=vamsas.git diff --git a/src/uk/ac/vamsas/objects/core/AlignmentAnnotation.java b/src/uk/ac/vamsas/objects/core/AlignmentAnnotation.java index 0ffea12..b6c544c 100644 --- a/src/uk/ac/vamsas/objects/core/AlignmentAnnotation.java +++ b/src/uk/ac/vamsas/objects/core/AlignmentAnnotation.java @@ -44,8 +44,9 @@ implements java.io.Serializable private boolean _has_graph; /** - * annotation is associated with a - * range on a particular group of alignment sequences + * annotation is associated with + * a range on a particular group of alignment + * sequences */ private java.util.Vector _seqrefs; @@ -131,23 +132,55 @@ implements java.io.Serializable if (obj instanceof AlignmentAnnotation) { AlignmentAnnotation temp = (AlignmentAnnotation)obj; + boolean thcycle; + boolean tmcycle; if (this._graph != temp._graph) return false; if (this._has_graph != temp._has_graph) return false; if (this._seqrefs != null) { if (temp._seqrefs == null) return false; - else if (!(this._seqrefs.equals(temp._seqrefs))) - return false; - } - else if (temp._seqrefs != null) + if (this._seqrefs != temp._seqrefs) { + thcycle=org.castor.util.CycleBreaker.startingToCycle(this._seqrefs); + tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._seqrefs); + if (thcycle!=tmcycle) { + if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._seqrefs); }; + if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqrefs); }; + return false; + } + if (!thcycle) { + if (!this._seqrefs.equals(temp._seqrefs)) { + org.castor.util.CycleBreaker.releaseCycleHandle(this._seqrefs); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqrefs); + return false; + } + org.castor.util.CycleBreaker.releaseCycleHandle(this._seqrefs); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqrefs); + } + } + } else if (temp._seqrefs != null) return false; if (this._provenance != null) { if (temp._provenance == null) return false; - else if (!(this._provenance.equals(temp._provenance))) - return false; - } - else if (temp._provenance != null) + if (this._provenance != temp._provenance) { + thcycle=org.castor.util.CycleBreaker.startingToCycle(this._provenance); + tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._provenance); + if (thcycle!=tmcycle) { + if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance); }; + if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance); }; + return false; + } + if (!thcycle) { + if (!this._provenance.equals(temp._provenance)) { + org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance); + return false; + } + org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance); + } + } + } else if (temp._provenance != null) return false; return true; } @@ -258,11 +291,15 @@ implements java.io.Serializable long tmp; result = 37 * result + (_graph?0:1); - if (_seqrefs != null) { + if (_seqrefs != null + && !org.castor.util.CycleBreaker.startingToCycle(_seqrefs)) { result = 37 * result + _seqrefs.hashCode(); + org.castor.util.CycleBreaker.releaseCycleHandle(_seqrefs); } - if (_provenance != null) { + if (_provenance != null + && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) { result = 37 * result + _provenance.hashCode(); + org.castor.util.CycleBreaker.releaseCycleHandle(_provenance); } return result;