JAL-892 schema changes (rnaViewer) for save Varna to project
[jalview.git] / src / jalview / schemabinding / version2 / JSeq.java
index d5eda07..193b005 100644 (file)
@@ -86,6 +86,17 @@ 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 +107,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();
     }
 
 
@@ -188,6 +200,34 @@ 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(
     ) {
@@ -248,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'.
@@ -424,6 +475,51 @@ 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.  <p>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 <i>know</i>
+     * 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'.
@@ -552,6 +648,13 @@ public class JSeq implements java.io.Serializable {
     }
 
     /**
+     */
+    public void removeAllRnaViewer(
+    ) {
+        this._rnaViewerList.clear();
+    }
+
+    /**
      * Method removeFeatures.
      * 
      * @param vFeatures
@@ -624,6 +727,30 @@ 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 the value of field 'colour'.
@@ -772,6 +899,41 @@ 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 the value of field 'start'.