X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemabinding%2Fversion2%2FJSeq.java;h=9ca6708cfaf1b424ecba1684a9164a679942c375;hb=4d7f98a6dd54d9863ba449ec79dcd95d25ed863d;hp=1a116076b773469b3459060a10c4051dd12a3909;hpb=b57a02c25e335d033c97f8a6bacd6b54f62bd2b6;p=jalview.git diff --git a/src/jalview/schemabinding/version2/JSeq.java b/src/jalview/schemabinding/version2/JSeq.java index 1a11607..9ca6708 100644 --- a/src/jalview/schemabinding/version2/JSeq.java +++ b/src/jalview/schemabinding/version2/JSeq.java @@ -86,6 +86,15 @@ public class JSeq implements java.io.Serializable */ private java.util.Vector _hiddenSequencesList; + /** + * Reference to a viewer showing RNA structure for this sequence. Schema + * supports one viewer showing multiple annotations for multiple sequences, + * though currently only one annotation for one sequence (gapped or trimmed) + * is used + * + */ + private java.util.Vector _rnaViewerList; + // ----------------/ // - Constructors -/ // ----------------/ @@ -96,6 +105,7 @@ public class JSeq implements java.io.Serializable this._featuresList = new java.util.Vector(); this._pdbidsList = new java.util.Vector(); this._hiddenSequencesList = new java.util.Vector(); + this._rnaViewerList = new java.util.Vector(); } // -----------/ @@ -189,6 +199,35 @@ public class JSeq implements java.io.Serializable } /** + * + * + * @param vRnaViewer + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void addRnaViewer( + final jalview.schemabinding.version2.RnaViewer vRnaViewer) + throws java.lang.IndexOutOfBoundsException + { + this._rnaViewerList.addElement(vRnaViewer); + } + + /** + * + * + * @param index + * @param vRnaViewer + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void addRnaViewer(final int index, + final jalview.schemabinding.version2.RnaViewer vRnaViewer) + throws java.lang.IndexOutOfBoundsException + { + this._rnaViewerList.add(index, vRnaViewer); + } + + /** */ public void deleteColour() { @@ -249,6 +288,17 @@ public class JSeq implements java.io.Serializable } /** + * Method enumerateRnaViewer. + * + * @return an Enumeration over all jalview.schemabinding.version2.RnaViewer + * elements + */ + public java.util.Enumeration enumerateRnaViewer() + { + return this._rnaViewerList.elements(); + } + + /** * Returns the value of field 'colour'. * * @return the value of field 'Colour'. @@ -439,6 +489,56 @@ public class JSeq implements java.io.Serializable } /** + * Method getRnaViewer. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + * @return the value of the jalview.schemabinding.version2.RnaViewer at the + * given index + */ + public jalview.schemabinding.version2.RnaViewer getRnaViewer( + final int index) throws java.lang.IndexOutOfBoundsException + { + // check bounds for index + if (index < 0 || index >= this._rnaViewerList.size()) + { + throw new IndexOutOfBoundsException("getRnaViewer: Index value '" + + index + "' not in range [0.." + + (this._rnaViewerList.size() - 1) + "]"); + } + + return (jalview.schemabinding.version2.RnaViewer) _rnaViewerList + .get(index); + } + + /** + * Method getRnaViewer.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 jalview.schemabinding.version2.RnaViewer[] getRnaViewer() + { + jalview.schemabinding.version2.RnaViewer[] array = new jalview.schemabinding.version2.RnaViewer[0]; + return (jalview.schemabinding.version2.RnaViewer[]) this._rnaViewerList + .toArray(array); + } + + /** + * Method getRnaViewerCount. + * + * @return the size of this collection + */ + public int getRnaViewerCount() + { + return this._rnaViewerList.size(); + } + + /** * Returns the value of field 'start'. * * @return the value of field 'Start'. @@ -574,6 +674,13 @@ public class JSeq implements java.io.Serializable } /** + */ + public void removeAllRnaViewer() + { + this._rnaViewerList.clear(); + } + + /** * Method removeFeatures. * * @param vFeatures @@ -651,6 +758,32 @@ public class JSeq implements java.io.Serializable } /** + * Method removeRnaViewer. + * + * @param vRnaViewer + * @return true if the object was removed from the collection. + */ + public boolean removeRnaViewer( + final jalview.schemabinding.version2.RnaViewer vRnaViewer) + { + boolean removed = _rnaViewerList.remove(vRnaViewer); + return removed; + } + + /** + * Method removeRnaViewerAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.schemabinding.version2.RnaViewer removeRnaViewerAt( + final int index) + { + java.lang.Object obj = this._rnaViewerList.remove(index); + return (jalview.schemabinding.version2.RnaViewer) obj; + } + + /** * Sets the value of field 'colour'. * * @param colour @@ -819,6 +952,46 @@ public class JSeq implements java.io.Serializable } /** + * + * + * @param index + * @param vRnaViewer + * @throws java.lang.IndexOutOfBoundsException + * if the index given is outside the bounds of the collection + */ + public void setRnaViewer(final int index, + final jalview.schemabinding.version2.RnaViewer vRnaViewer) + throws java.lang.IndexOutOfBoundsException + { + // check bounds for index + if (index < 0 || index >= this._rnaViewerList.size()) + { + throw new IndexOutOfBoundsException("setRnaViewer: Index value '" + + index + "' not in range [0.." + + (this._rnaViewerList.size() - 1) + "]"); + } + + this._rnaViewerList.set(index, vRnaViewer); + } + + /** + * + * + * @param vRnaViewerArray + */ + public void setRnaViewer( + final jalview.schemabinding.version2.RnaViewer[] vRnaViewerArray) + { + // -- copy array + _rnaViewerList.clear(); + + for (int i = 0; i < vRnaViewerArray.length; i++) + { + this._rnaViewerList.add(vRnaViewerArray[i]); + } + } + + /** * Sets the value of field 'start'. * * @param start