X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fuk%2Fac%2Fvamsas%2Fobjects%2Fcore%2FSequenceMapping.java;h=7f7bcb0b0ffd30117ec9ae89dde8080eaab5a624;hb=f5306591821b5f6d4e381ff30b647bd149d51f43;hp=e7776a7bef85068a4f6971040e3ceb774ed1c11c;hpb=561e4251325edd3a70a0f3ffc6ef79bc62a3a107;p=vamsas.git diff --git a/src/uk/ac/vamsas/objects/core/SequenceMapping.java b/src/uk/ac/vamsas/objects/core/SequenceMapping.java index e7776a7..7f7bcb0 100644 --- a/src/uk/ac/vamsas/objects/core/SequenceMapping.java +++ b/src/uk/ac/vamsas/objects/core/SequenceMapping.java @@ -19,7 +19,7 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class SequenceMapping extends uk.ac.vamsas.client.Vobject +public class SequenceMapping extends uk.ac.vamsas.objects.core.MapType implements java.io.Serializable { @@ -29,14 +29,16 @@ implements java.io.Serializable //--------------------------/ /** - * Field _sequenceA. + * Object on which the local + * range is defined. */ - private java.lang.Object _sequenceA; + private java.lang.Object _loc; /** - * Field _sequenceB. + * Object on which the mapped + * range is defined. */ - private java.lang.Object _sequenceB; + private java.lang.Object _map; /** * Field _id. @@ -44,11 +46,6 @@ implements java.io.Serializable private java.lang.String _id; /** - * Field _rangeList. - */ - private java.util.Vector _rangeList; - - /** * Field _provenance. */ private uk.ac.vamsas.objects.core.Provenance _provenance; @@ -60,7 +57,6 @@ implements java.io.Serializable public SequenceMapping() { super(); - this._rangeList = new java.util.Vector(); } @@ -69,45 +65,6 @@ implements java.io.Serializable //-----------/ /** - * - * - * @param vRange - * @throws java.lang.IndexOutOfBoundsException if the index - * given is outside the bounds of the collection - */ - public void addRange( - final uk.ac.vamsas.objects.core.Range vRange) - throws java.lang.IndexOutOfBoundsException { - this._rangeList.addElement(vRange); - } - - /** - * - * - * @param index - * @param vRange - * @throws java.lang.IndexOutOfBoundsException if the index - * given is outside the bounds of the collection - */ - public void addRange( - final int index, - final uk.ac.vamsas.objects.core.Range vRange) - throws java.lang.IndexOutOfBoundsException { - this._rangeList.add(index, vRange); - } - - /** - * Method enumerateRange. - * - * @return an Enumeration over all - * uk.ac.vamsas.objects.core.Range elements - */ - public java.util.Enumeration enumerateRange( - ) { - return this._rangeList.elements(); - } - - /** * Overrides the java.lang.Object.equals method. * * @param obj @@ -124,40 +81,95 @@ implements java.io.Serializable if (obj instanceof SequenceMapping) { SequenceMapping temp = (SequenceMapping)obj; - if (this._sequenceA != null) { - if (temp._sequenceA == null) return false; - else if (!(this._sequenceA.equals(temp._sequenceA))) - return false; - } - else if (temp._sequenceA != null) + boolean thcycle; + boolean tmcycle; + if (this._loc != null) { + if (temp._loc == null) return false; + if (this._loc != temp._loc) { + thcycle=org.castor.util.CycleBreaker.startingToCycle(this._loc); + tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._loc); + if (thcycle!=tmcycle) { + if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._loc); }; + if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._loc); }; + return false; + } + if (!thcycle) { + if (!this._loc.equals(temp._loc)) { + org.castor.util.CycleBreaker.releaseCycleHandle(this._loc); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._loc); + return false; + } + org.castor.util.CycleBreaker.releaseCycleHandle(this._loc); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._loc); + } + } + } else if (temp._loc != null) return false; - if (this._sequenceB != null) { - if (temp._sequenceB == null) return false; - else if (!(this._sequenceB.equals(temp._sequenceB))) - return false; - } - else if (temp._sequenceB != null) + if (this._map != null) { + if (temp._map == null) return false; + if (this._map != temp._map) { + thcycle=org.castor.util.CycleBreaker.startingToCycle(this._map); + tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._map); + if (thcycle!=tmcycle) { + if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._map); }; + if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._map); }; + return false; + } + if (!thcycle) { + if (!this._map.equals(temp._map)) { + org.castor.util.CycleBreaker.releaseCycleHandle(this._map); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._map); + return false; + } + org.castor.util.CycleBreaker.releaseCycleHandle(this._map); + org.castor.util.CycleBreaker.releaseCycleHandle(temp._map); + } + } + } else if (temp._map != 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) - return false; - if (this._rangeList != null) { - if (temp._rangeList == null) return false; - else if (!(this._rangeList.equals(temp._rangeList))) - return false; - } - else if (temp._rangeList != 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._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; } @@ -175,90 +187,37 @@ implements java.io.Serializable } /** - * Returns the value of field 'provenance'. - * - * @return the value of field 'Provenance'. - */ - public uk.ac.vamsas.objects.core.Provenance getProvenance( - ) { - return this._provenance; - } - - /** - * Method getRange. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException if the index - * given is outside the bounds of the collection - * @return the value of the uk.ac.vamsas.objects.core.Range at - * the given index - */ - public uk.ac.vamsas.objects.core.Range getRange( - final int index) - throws java.lang.IndexOutOfBoundsException { - // check bounds for index - if (index < 0 || index >= this._rangeList.size()) { - throw new IndexOutOfBoundsException("getRange: Index value '" + index + "' not in range [0.." + (this._rangeList.size() - 1) + "]"); - } - - return (uk.ac.vamsas.objects.core.Range) _rangeList.get(index); - } - - /** - * Method getRange.Returns the contents of the collection in an - * Array.
Note: Just in case the collection contents are - * changing in another thread, we pass a 0-length Array of the - * correct type into the API call. This way we know - * that the Array returned is of exactly the correct length. + * Returns the value of field 'loc'. The field 'loc' has the + * following description: Object on which the local + * range is defined. * - * @return this collection as an Array + * @return the value of field 'Loc'. */ - public uk.ac.vamsas.objects.core.Range[] getRange( + public java.lang.Object getLoc( ) { - uk.ac.vamsas.objects.core.Range[] array = new uk.ac.vamsas.objects.core.Range[0]; - return (uk.ac.vamsas.objects.core.Range[]) this._rangeList.toArray(array); + return this._loc; } /** - * Method getRangeAsReference.Returns a reference to - * '_rangeList'. No type checking is performed on any - * modifications to the Vector. + * Returns the value of field 'map'. The field 'map' has the + * following description: Object on which the mapped + * range is defined. * - * @return a reference to the Vector backing this class + * @return the value of field 'Map'. */ - public java.util.Vector getRangeAsReference( + public java.lang.Object getMap( ) { - return this._rangeList; + return this._map; } /** - * Method getRangeCount. - * - * @return the size of this collection - */ - public int getRangeCount( - ) { - return this._rangeList.size(); - } - - /** - * Returns the value of field 'sequenceA'. - * - * @return the value of field 'SequenceA'. - */ - public java.lang.Object getSequenceA( - ) { - return this._sequenceA; - } - - /** - * Returns the value of field 'sequenceB'. + * Returns the value of field 'provenance'. * - * @return the value of field 'SequenceB'. + * @return the value of field 'Provenance'. */ - public java.lang.Object getSequenceB( + public uk.ac.vamsas.objects.core.Provenance getProvenance( ) { - return this._sequenceB; + return this._provenance; } /** @@ -274,20 +233,25 @@ implements java.io.Serializable int result = super.hashCode(); long tmp; - if (_sequenceA != null) { - result = 37 * result + _sequenceA.hashCode(); + if (_loc != null + && !org.castor.util.CycleBreaker.startingToCycle(_loc)) { + result = 37 * result + _loc.hashCode(); + org.castor.util.CycleBreaker.releaseCycleHandle(_loc); } - if (_sequenceB != null) { - result = 37 * result + _sequenceB.hashCode(); + if (_map != null + && !org.castor.util.CycleBreaker.startingToCycle(_map)) { + result = 37 * result + _map.hashCode(); + org.castor.util.CycleBreaker.releaseCycleHandle(_map); } - if (_id != null) { + if (_id != null + && !org.castor.util.CycleBreaker.startingToCycle(_id)) { result = 37 * result + _id.hashCode(); + org.castor.util.CycleBreaker.releaseCycleHandle(_id); } - if (_rangeList != null) { - result = 37 * result + _rangeList.hashCode(); - } - 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; @@ -341,37 +305,6 @@ implements java.io.Serializable } /** - */ - public void removeAllRange( - ) { - this._rangeList.clear(); - } - - /** - * Method removeRange. - * - * @param vRange - * @return true if the object was removed from the collection. - */ - public boolean removeRange( - final uk.ac.vamsas.objects.core.Range vRange) { - boolean removed = _rangeList.remove(vRange); - return removed; - } - - /** - * Method removeRangeAt. - * - * @param index - * @return the element removed from the collection - */ - public uk.ac.vamsas.objects.core.Range removeRangeAt( - final int index) { - java.lang.Object obj = this._rangeList.remove(index); - return (uk.ac.vamsas.objects.core.Range) obj; - } - - /** * Sets the value of field 'id'. * * @param id the value of field 'id'. @@ -382,94 +315,37 @@ implements java.io.Serializable } /** - * Sets the value of field 'provenance'. - * - * @param provenance the value of field 'provenance'. - */ - public void setProvenance( - final uk.ac.vamsas.objects.core.Provenance provenance) { - this._provenance = provenance; - } - - /** + * Sets the value of field 'loc'. The field 'loc' has the + * following description: Object on which the local + * range is defined. * - * - * @param index - * @param vRange - * @throws java.lang.IndexOutOfBoundsException if the index - * given is outside the bounds of the collection - */ - public void setRange( - final int index, - final uk.ac.vamsas.objects.core.Range vRange) - throws java.lang.IndexOutOfBoundsException { - // check bounds for index - if (index < 0 || index >= this._rangeList.size()) { - throw new IndexOutOfBoundsException("setRange: Index value '" + index + "' not in range [0.." + (this._rangeList.size() - 1) + "]"); - } - - this._rangeList.set(index, vRange); - } - - /** - * - * - * @param vRangeArray + * @param loc the value of field 'loc'. */ - public void setRange( - final uk.ac.vamsas.objects.core.Range[] vRangeArray) { - //-- copy array - _rangeList.clear(); - - for (int i = 0; i < vRangeArray.length; i++) { - this._rangeList.add(vRangeArray[i]); - } + public void setLoc( + final java.lang.Object loc) { + this._loc = loc; } /** - * Sets the value of '_rangeList' by copying the given Vector. - * All elements will be checked for type safety. + * Sets the value of field 'map'. The field 'map' has the + * following description: Object on which the mapped + * range is defined. * - * @param vRangeList the Vector to copy. + * @param map the value of field 'map'. */ - public void setRange( - final java.util.Vector vRangeList) { - // copy vector - this._rangeList.clear(); - - this._rangeList.addAll(vRangeList); + public void setMap( + final java.lang.Object map) { + this._map = map; } /** - * Sets the value of '_rangeList' by setting it to the given - * Vector. No type checking is performed. - * @deprecated - * - * @param rangeVector the Vector to set. - */ - public void setRangeAsReference( - final java.util.Vector rangeVector) { - this._rangeList = rangeVector; - } - - /** - * Sets the value of field 'sequenceA'. - * - * @param sequenceA the value of field 'sequenceA'. - */ - public void setSequenceA( - final java.lang.Object sequenceA) { - this._sequenceA = sequenceA; - } - - /** - * Sets the value of field 'sequenceB'. + * Sets the value of field 'provenance'. * - * @param sequenceB the value of field 'sequenceB'. + * @param provenance the value of field 'provenance'. */ - public void setSequenceB( - final java.lang.Object sequenceB) { - this._sequenceB = sequenceB; + public void setProvenance( + final uk.ac.vamsas.objects.core.Provenance provenance) { + this._provenance = provenance; } /** @@ -480,13 +356,12 @@ implements java.io.Serializable * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema - * @return the unmarshaled - * uk.ac.vamsas.objects.core.SequenceMapping + * @return the unmarshaled uk.ac.vamsas.objects.core.MapType */ - public static uk.ac.vamsas.objects.core.SequenceMapping unmarshal( + public static uk.ac.vamsas.objects.core.MapType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { - return (uk.ac.vamsas.objects.core.SequenceMapping) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.SequenceMapping.class, reader); + return (uk.ac.vamsas.objects.core.MapType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.SequenceMapping.class, reader); } /**