X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fschemabinding%2Fversion2%2FJSeq.java;h=9ca6708cfaf1b424ecba1684a9164a679942c375;hb=2dcd2b8cfb1b38575c8b2246d59ba1c1a2fb59cd;hp=31a128ebb3f96b3b8d88e90e589dcc62d4b41d7b;hpb=aced09c4feeaf3406269442c14e54abeeb4cad81;p=jalview.git
diff --git a/src/jalview/schemabinding/version2/JSeq.java b/src/jalview/schemabinding/version2/JSeq.java
index 31a128e..9ca6708 100644
--- a/src/jalview/schemabinding/version2/JSeq.java
+++ b/src/jalview/schemabinding/version2/JSeq.java
@@ -1,31 +1,16 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. 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 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'. @@ -594,6 +674,13 @@ public class JSeq implements java.io.Serializable } /** + */ + public void removeAllRnaViewer() + { + this._rnaViewerList.clear(); + } + + /** * Method removeFeatures. * * @param vFeatures @@ -671,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 @@ -709,11 +822,9 @@ public class JSeq implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._featuresList.size()) { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setFeatures", - Integer.valueOf(index).toString(), - Integer.valueOf((this._featuresList.size() - 1)).toString() - })); + throw new IndexOutOfBoundsException("setFeatures: Index value '" + + index + "' not in range [0.." + + (this._featuresList.size() - 1) + "]"); } this._featuresList.set(index, vFeatures); @@ -762,11 +873,10 @@ public class JSeq implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._hiddenSequencesList.size()) { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setHiddenSequences", - Integer.valueOf(index).toString(), - Integer.valueOf((this._hiddenSequencesList.size() - 1)).toString() - })); + throw new IndexOutOfBoundsException( + "setHiddenSequences: Index value '" + index + + "' not in range [0.." + + (this._hiddenSequencesList.size() - 1) + "]"); } this._hiddenSequencesList.set(index, new java.lang.Integer( @@ -816,11 +926,9 @@ public class JSeq implements java.io.Serializable // check bounds for index if (index < 0 || index >= this._pdbidsList.size()) { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setPdbids", - Integer.valueOf(index).toString(), - Integer.valueOf((this._pdbidsList.size() - 1)).toString() - })); + throw new IndexOutOfBoundsException("setPdbids: Index value '" + + index + "' not in range [0.." + + (this._pdbidsList.size() - 1) + "]"); } this._pdbidsList.set(index, vPdbids); @@ -844,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