Jalview.isJS() --> Platform.isJS(), DBRefEntry[] --> List<DBRefEntry>
[jalview.git] / src / jalview / io / ModellerDescription.java
index 5c8231e..7e05b15 100755 (executable)
@@ -1,23 +1,29 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ 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.
+ * 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 <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.io;
 
-import jalview.datamodel.*;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.SequenceI;
+
+import java.util.List;
 
 public class ModellerDescription
 {
@@ -26,13 +32,12 @@ public class ModellerDescription
    * single line, and sequence start/end and other properties. See PIRFile IO
    * for its use.
    */
-  final String[] seqTypes =
-  { "sequence", "structure", "structureX", "structureN" };
+  final String[] seqTypes = { "sequence", "structure", "structureX",
+      "structureN" };
 
-  final String[] Fields =
-  { "objectType", "objectId", "startField", "startCode", "endField",
-      "endCode", "description1", "description2", "resolutionField",
-      "tailField" };
+  final String[] Fields = { "objectType", "objectId", "startField",
+      "startCode", "endField", "endCode", "description1", "description2",
+      "resolutionField", "tailField" };
 
   final int TYPE = 0;
 
@@ -57,11 +62,10 @@ public class ModellerDescription
   /**
    * 0 is free text or empty 1 is something that parses to an integer, or \@
    */
-  final int Types[] =
-  { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 };
+  final int Types[] = { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 };
 
-  final char Padding[] =
-  { ' ', ' ', ' ', '.', ' ', '.', '.', '.', '.', '.' };
+  final char Padding[] = { ' ', ' ', ' ', '.', ' ', '.', '.', '.', '.',
+      '.' };
 
   java.util.Hashtable fields = new java.util.Hashtable();
 
@@ -244,15 +248,15 @@ public class ModellerDescription
     {
       // Set start and end before we update the type (in the case of a
       // synthesized field set)
-      if (getStartCode() == null
-              || (getStartNum() != seq.getStart() && getStartCode().val != null))
+      if (getStartCode() == null || (getStartNum() != seq.getStart()
+              && getStartCode().val != null))
       {
         // unset or user updated sequence start position
         setStartCode(seq.getStart());
       }
 
-      if (getEndCode() == null
-              || (getEndNum() != seq.getEnd() && getStartCode() != null && getStartCode().val != null))
+      if (getEndCode() == null || (getEndNum() != seq.getEnd()
+              && getStartCode() != null && getStartCode().val != null))
       {
         setEndCode(seq.getEnd());
       }
@@ -268,23 +272,22 @@ public class ModellerDescription
       // sets the local reference field
       int t = 0; // sequence
       if (seq.getDatasetSequence() != null
-              && seq.getDatasetSequence().getDBRef() != null)
+              && seq.getDatasetSequence().getDBRefs() != null)
       {
-        jalview.datamodel.DBRefEntry[] dbr = seq.getDatasetSequence()
-                .getDBRef();
-        int i, j;
-        for (i = 0, j = dbr.length; i < j; i++)
+        List<DBRefEntry> dbr = seq.getDatasetSequence().getDBRefs();
+        for (int i = 0, ni = dbr.size(); i < ni; i++)
         {
-          if (dbr[i] != null)
+               DBRefEntry dbri = dbr.get(i);
+          if (dbri != null)
           {
             // JBPNote PDB dbRefEntry needs properties to propagate onto
             // ModellerField
             // JBPNote Need to get info from the user about whether the sequence
             // is the one being modelled, or if it is a template.
-            if (dbr[i].getSource()
+            if (dbri.getSource()
                     .equals(jalview.datamodel.DBRefSource.PDB))
             {
-              fields.put(Fields[LOCALID], dbr[i].getAccessionId());
+              fields.put(Fields[LOCALID], dbri.getAccessionId());
               t = 2;
               break;
             }