/*
* This file is part of the Vamsas Client version 0.1.
* Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
* Andrew Waterhouse and Dominik Lindner.
*
* Earlier versions have also been incorporated into Jalview version 2.4
* since 2008, and TOPALi version 2 since 2007.
*
* The Vamsas Client is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Vamsas Client is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the Vamsas Client. If not, see
* 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. * * @return this collection as an Array */ public uk.ac.vamsas.objects.core.DbRef[] getDbRef() { uk.ac.vamsas.objects.core.DbRef[] array = new uk.ac.vamsas.objects.core.DbRef[0]; return (uk.ac.vamsas.objects.core.DbRef[]) this._dbRefList.toArray(array); } /** * Method getDbRefAsReference.Returns a reference to '_dbRefList'. No type * checking is performed on any modifications to the Vector. * * @return a reference to the Vector backing this class */ public java.util.Vector getDbRefAsReference() { return this._dbRefList; } /** * Method getDbRefCount. * * @return the size of this collection */ public int getDbRefCount() { return this._dbRefList.size(); } /** * Returns the value of field 'dictionary'. The field 'dictionary' has the * following description: symbol class for sequence * * * @return the value of field 'Dictionary'. */ public java.lang.String getDictionary() { return this._dictionary; } /** * Returns the value of field 'id'. The field 'id' has the following * description: Primary Key for vamsas object referencing * * * @return the value of field 'Id'. */ public java.lang.String getId() { return this._id; } /** * Method getVxref. * * @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.Vxref at the given index */ public uk.ac.vamsas.objects.core.Vxref getVxref(final int index) throws java.lang.IndexOutOfBoundsException { // check bounds for index if (index < 0 || index >= this._vxrefList.size()) { throw new IndexOutOfBoundsException("getVxref: Index value '" + index + "' not in range [0.." + (this._vxrefList.size() - 1) + "]"); } return (uk.ac.vamsas.objects.core.Vxref) _vxrefList.get(index); } /** * Method getVxref.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. * * @return this collection as an Array */ public uk.ac.vamsas.objects.core.Vxref[] getVxref() { uk.ac.vamsas.objects.core.Vxref[] array = new uk.ac.vamsas.objects.core.Vxref[0]; return (uk.ac.vamsas.objects.core.Vxref[]) this._vxrefList.toArray(array); } /** * Method getVxrefAsReference.Returns a reference to '_vxrefList'. No type * checking is performed on any modifications to the Vector. * * @return a reference to the Vector backing this class */ public java.util.Vector getVxrefAsReference() { return this._vxrefList; } /** * Method getVxrefCount. * * @return the size of this collection */ public int getVxrefCount() { return this._vxrefList.size(); } /** * Overrides the java.lang.Object.hashCode method. *
* The following steps came from Effective Java Programming Language * Guide by Joshua Bloch, Chapter 3 * * @return a hash code value for the object. */ public int hashCode() { int result = super.hashCode(); long tmp; if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) { result = 37 * result + _id.hashCode(); org.castor.util.CycleBreaker.releaseCycleHandle(_id); } if (_dictionary != null && !org.castor.util.CycleBreaker.startingToCycle(_dictionary)) { result = 37 * result + _dictionary.hashCode(); org.castor.util.CycleBreaker.releaseCycleHandle(_dictionary); } if (_dbRefList != null && !org.castor.util.CycleBreaker.startingToCycle(_dbRefList)) { result = 37 * result + _dbRefList.hashCode(); org.castor.util.CycleBreaker.releaseCycleHandle(_dbRefList); } if (_vxrefList != null && !org.castor.util.CycleBreaker.startingToCycle(_vxrefList)) { result = 37 * result + _vxrefList.hashCode(); org.castor.util.CycleBreaker.releaseCycleHandle(_vxrefList); } return result; } /** * Method isValid. * * @return true if this object is valid according to the schema */ public boolean isValid() { try { validate(); } catch (org.exolab.castor.xml.ValidationException vex) { return false; } return true; } /** * * * @param out * @throws org.exolab.castor.xml.MarshalException * if object is 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 */ public void marshal(final java.io.Writer out) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { Marshaller.marshal(this, out); } /** * * * @param handler * @throws java.io.IOException * if an IOException occurs during marshaling * @throws org.exolab.castor.xml.ValidationException * if this object is an invalid instance according to the schema * @throws org.exolab.castor.xml.MarshalException * if object is null or if any SAXException is thrown during * marshaling */ public void marshal(final org.xml.sax.ContentHandler handler) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { Marshaller.marshal(this, handler); } /** */ public void removeAllDbRef() { this._dbRefList.clear(); } /** */ public void removeAllVxref() { this._vxrefList.clear(); } /** * Method removeDbRef. * * @param vDbRef * @return true if the object was removed from the collection. */ public boolean removeDbRef(final uk.ac.vamsas.objects.core.DbRef vDbRef) { boolean removed = _dbRefList.remove(vDbRef); return removed; } /** * Method removeDbRefAt. * * @param index * @return the element removed from the collection */ public uk.ac.vamsas.objects.core.DbRef removeDbRefAt(final int index) { java.lang.Object obj = this._dbRefList.remove(index); return (uk.ac.vamsas.objects.core.DbRef) obj; } /** * Method removeVxref. * * @param vVxref * @return true if the object was removed from the collection. */ public boolean removeVxref(final uk.ac.vamsas.objects.core.Vxref vVxref) { boolean removed = _vxrefList.remove(vVxref); return removed; } /** * Method removeVxrefAt. * * @param index * @return the element removed from the collection */ public uk.ac.vamsas.objects.core.Vxref removeVxrefAt(final int index) { java.lang.Object obj = this._vxrefList.remove(index); return (uk.ac.vamsas.objects.core.Vxref) obj; } /** * * * @param index * @param vDbRef * @throws java.lang.IndexOutOfBoundsException * if the index given is outside the bounds of the collection */ public void setDbRef(final int index, final uk.ac.vamsas.objects.core.DbRef vDbRef) throws java.lang.IndexOutOfBoundsException { // check bounds for index if (index < 0 || index >= this._dbRefList.size()) { throw new IndexOutOfBoundsException("setDbRef: Index value '" + index + "' not in range [0.." + (this._dbRefList.size() - 1) + "]"); } this._dbRefList.set(index, vDbRef); } /** * * * @param vDbRefArray */ public void setDbRef(final uk.ac.vamsas.objects.core.DbRef[] vDbRefArray) { // -- copy array _dbRefList.clear(); for (int i = 0; i < vDbRefArray.length; i++) { this._dbRefList.add(vDbRefArray[i]); } } /** * Sets the value of '_dbRefList' by copying the given Vector. All elements * will be checked for type safety. * * @param vDbRefList * the Vector to copy. */ public void setDbRef(final java.util.Vector vDbRefList) { // copy vector this._dbRefList.clear(); this._dbRefList.addAll(vDbRefList); } /** * Sets the value of '_dbRefList' by setting it to the given Vector. No type * checking is performed. * * @deprecated * * @param dbRefVector * the Vector to set. */ public void setDbRefAsReference(final java.util.Vector dbRefVector) { this._dbRefList = dbRefVector; } /** * Sets the value of field 'dictionary'. The field 'dictionary' has the * following description: symbol class for sequence * * * @param dictionary * the value of field 'dictionary'. */ public void setDictionary(final java.lang.String dictionary) { this._dictionary = dictionary; } /** * Sets the value of field 'id'. The field 'id' has the following description: * Primary Key for vamsas object referencing * * * @param id * the value of field 'id'. */ public void setId(final java.lang.String id) { this._id = id; } /** * * * @param index * @param vVxref * @throws java.lang.IndexOutOfBoundsException * if the index given is outside the bounds of the collection */ public void setVxref(final int index, final uk.ac.vamsas.objects.core.Vxref vVxref) throws java.lang.IndexOutOfBoundsException { // check bounds for index if (index < 0 || index >= this._vxrefList.size()) { throw new IndexOutOfBoundsException("setVxref: Index value '" + index + "' not in range [0.." + (this._vxrefList.size() - 1) + "]"); } this._vxrefList.set(index, vVxref); } /** * * * @param vVxrefArray */ public void setVxref(final uk.ac.vamsas.objects.core.Vxref[] vVxrefArray) { // -- copy array _vxrefList.clear(); for (int i = 0; i < vVxrefArray.length; i++) { this._vxrefList.add(vVxrefArray[i]); } } /** * Sets the value of '_vxrefList' by copying the given Vector. All elements * will be checked for type safety. * * @param vVxrefList * the Vector to copy. */ public void setVxref(final java.util.Vector vVxrefList) { // copy vector this._vxrefList.clear(); this._vxrefList.addAll(vVxrefList); } /** * Sets the value of '_vxrefList' by setting it to the given Vector. No type * checking is performed. * * @deprecated * * @param vxrefVector * the Vector to set. */ public void setVxrefAsReference(final java.util.Vector vxrefVector) { this._vxrefList = vxrefVector; } /** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException * if object is 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.SequenceTyp */ public static uk.ac.vamsas.objects.core.SequenceType unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (uk.ac.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal( uk.ac.vamsas.objects.core.Sequence.class, reader); } /** * * * @throws org.exolab.castor.xml.ValidationException * if this object is an invalid instance according to the schema */ public void validate() throws org.exolab.castor.xml.ValidationException { org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); validator.validate(this); } }