refactored document objects and bugfix on jvdataset-vamsasdataset binding
[jalview.git] / src / jalview / io / ModellerDescription.java
index 1e4f905..fa6ef6d 100755 (executable)
@@ -1,15 +1,33 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.io;\r
 \r
-import jalview.datamodel.SequenceI;\r
-import java.util.Vector;\r
+import jalview.datamodel.*;\r
+\r
 public class ModellerDescription\r
 {\r
-    /**\r
-     * Translates between a String containing a set of colon-separated values\r
-     * on a single line, and sequence start/end and other properties.\r
-     * See PIRFile IO for its use.\r
-     */\r
-    final String[] seqTypes =\r
+  /**\r
+   * Translates between a String containing a set of colon-separated values\r
+   * on a single line, and sequence start/end and other properties.\r
+   * See PIRFile IO for its use.\r
+   */\r
+  final String[] seqTypes =\r
       {\r
       "sequence", "structure", "structureX", "structureN"};\r
   final String[] Fields =\r
@@ -69,7 +87,8 @@ public class ModellerDescription
   private resCode validResidueCode(String field)\r
   {\r
     Integer val = null;\r
-    com.stevesoft.pat.Regex r = new com.stevesoft.pat.Regex("\\s*((([-0-9]+).?)|FIRST|LAST|@)");\r
+    com.stevesoft.pat.Regex r = new com.stevesoft.pat.Regex(\r
+        "\\s*((([-0-9]+).?)|FIRST|LAST|@)");\r
 \r
     if (!r.search(field))\r
     {\r
@@ -80,8 +99,8 @@ public class ModellerDescription
     {\r
       value = r.stringMatched(1);\r
     }\r
-   // jalview.bin.Cache.log.debug("from '" + field + "' matched '" + value +\r
-   //                             "'");\r
+    // jalview.bin.Cache.log.debug("from '" + field + "' matched '" + value +\r
+    //                             "'");\r
     try\r
     {\r
       val = Integer.valueOf(value);\r
@@ -106,7 +125,7 @@ public class ModellerDescription
       field = st.nextToken(":");\r
       do\r
       {\r
-        if (seqTypes[i].equalsIgnoreCase(field) )\r
+        if (seqTypes[i].equalsIgnoreCase(field))\r
         {\r
           break;\r
         }\r
@@ -132,8 +151,8 @@ public class ModellerDescription
               }\r
               else\r
               {\r
-          //      jalview.bin.Cache.log.debug(\r
-         //           "Ignoring non-Modeller description: invalid integer-like field '" + field + "'");\r
+                //      jalview.bin.Cache.log.debug(\r
+                //           "Ignoring non-Modeller description: invalid integer-like field '" + field + "'");\r
                 type = -1; /* invalid field! - throw the FieldSet away */\r
               }\r
               ;\r
@@ -224,19 +243,17 @@ public class ModellerDescription
       if (seq.getDatasetSequence() != null &&\r
           seq.getDatasetSequence().getDBRef() != null)\r
       {\r
-        Vector dbr = seq.getDatasetSequence().getDBRef();\r
+        jalview.datamodel.DBRefEntry[] dbr = seq.getDatasetSequence().getDBRef();\r
         int i, j;\r
-        for (i = 0, j = dbr.size(); i < j; i++)\r
+        for (i = 0, j = dbr.length; i < j; i++)\r
         {\r
-          jalview.datamodel.DBRefEntry dref = (jalview.datamodel.DBRefEntry)\r
-              dbr.elementAt(i);\r
-          if (dref != null)\r
+          if (dbr[i] != null)\r
           {\r
             // JBPNote PDB dbRefEntry needs properties to propagate onto ModellerField\r
             // JBPNote Need to get info from the user about whether the sequence is the one being modelled, or if it is a template.\r
-            if (dref.getSource().equals(jalview.datamodel.DBRefSource.PDB))\r
+            if (dbr[i].getSource().equals(jalview.datamodel.DBRefSource.PDB))\r
             {\r
-              fields.put(Fields[LOCALID], dref.getAccessionId());\r
+              fields.put(Fields[LOCALID], dbr[i].getAccessionId());\r
               t = 2;\r
               break;\r
             }\r
@@ -372,4 +389,3 @@ public class ModellerDescription
     return false;\r
   }\r
 }\r
-\r