X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FModellerDescription.java;h=fd28956d3c9e8b22e961fa196410c29c0496de6a;hb=b2f9a8d7bce642ff4011bc6d49e02bb0569fbb11;hp=3b58519a3b4fe9a05b0c6689c09f031ea8f642c5;hpb=797df64fa2a0a30773d0f48f5494d4155e5a8be3;p=jalview.git diff --git a/src/jalview/io/ModellerDescription.java b/src/jalview/io/ModellerDescription.java index 3b58519..fd28956 100755 --- a/src/jalview/io/ModellerDescription.java +++ b/src/jalview/io/ModellerDescription.java @@ -1,19 +1,20 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1) + * 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 . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.io; @@ -119,8 +120,9 @@ public class ModellerDescription private java.util.Hashtable parseDescription(String desc) { java.util.Hashtable fields = new java.util.Hashtable(); - java.util.StringTokenizer st = new java.util.StringTokenizer(desc, ":",true); - + java.util.StringTokenizer st = new java.util.StringTokenizer(desc, ":", + true); + String field; int type = -1; if (st.countTokens() > 0) @@ -148,28 +150,31 @@ public class ModellerDescription { if (!field.equals(":")) { - // validate residue field value - if (Types[i] == 1) - { - resCode val = validResidueCode(field); - if (val != null) + // validate residue field value + if (Types[i] == 1) { - fields.put(new String(Fields[i] + "num"), val); + resCode val = validResidueCode(field); + if (val != null) + { + fields.put(new String(Fields[i] + "num"), val); + } + else + { + // jalview.bin.Cache.log.debug( + // "Ignoring non-Modeller description: invalid integer-like + // field '" + field + "'"); + type = -1; /* invalid field! - throw the FieldSet away */ + } + ; } - else + fields.put(Fields[i++], field); + if (st.hasMoreTokens()) { - // jalview.bin.Cache.log.debug( - // "Ignoring non-Modeller description: invalid integer-like - // field '" + field + "'"); - type = -1; /* invalid field! - throw the FieldSet away */ + st.nextToken(); // skip token sep. } - ; } - fields.put(Fields[i++], field); - if (st.hasMoreTokens()) { - st.nextToken(); // skip token sep. - } - } else { + else + { i++; } } @@ -180,7 +185,7 @@ public class ModellerDescription while (st.hasMoreTokens()) { String tl = st.nextToken(":"); - field += tl.equals(":") ? tl : (":" + tl); + field += tl.equals(":") ? tl : (":" + tl); } fields.put(Fields[TAIL], field); } @@ -240,13 +245,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()); } @@ -349,7 +356,7 @@ public class ModellerDescription { int start = 0; resCode val = getStartCode(); - if (val!=null && val.val != null) + if (val != null && val.val != null) { return val.val.intValue(); } @@ -378,7 +385,7 @@ public class ModellerDescription { int end = 0; resCode val = getEndCode(); - if (val!=null && val.val != null) + if (val != null && val.val != null) { return val.val.intValue(); } @@ -396,8 +403,8 @@ public class ModellerDescription { if (isModellerFieldset()) { - resCode rc=getStartCode(); - if (rc!=null && rc.val != null) + resCode rc = getStartCode(); + if (rc != null && rc.val != null) { newSeq.setStart(getStartNum()); } @@ -405,8 +412,8 @@ public class ModellerDescription { newSeq.setStart(1); } - rc=getEndCode(); - if (rc!=null && rc.val != null) + rc = getEndCode(); + if (rc != null && rc.val != null) { newSeq.setEnd(getEndNum()); }